js+css实现堆排序可视化动画效果代码
代码语言:html
所属分类:动画
代码描述:js+css实现堆排序可视化动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
font-family: Arial, sans-serif;
background: #222;
color: #eee;
margin: 0;
padding: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
h1 {
margin-bottom: 40px; /* bigger bottom margin for spacing */
z-index: 10;
}
section#visualization {
width: 100%;
max-width: 700px;
display: flex;
flex-direction: column;
align-items: center;
gap: 15px;
margin-top:200px;
}
#array-container {
display: flex;
gap: 5px;
height: 120px;
align-items: flex-end;
width: 100%;
}
.bar {
width: 30px;
background-color: #2196f3; /* blue */
text-align: center;
color: #fff;
border-radius: 4px 4px 0 0;
transition: background-color 0.3s ease;
font-weight: bold;
user-select: none;
}
.bar.highlight {
background-color: #f44336; /* red highlight */
}
.bar.sorted {
background-color: #4caf50; /* green for sorted */
}
button {
padding:.........完整代码请登录后点击上方下载按钮下载查看
网友评论0