overflow: hidden; /隐藏超出的部分/
}
.container {
width: 100%;
height: 100%;
position: relative;
}
/---------------------- body_left -------------------------/
.body_left {
width: 300px;
height: 300px;
left: 0;
bottom: 110px;
position: absolute;
z-index: 98;
}
/---------------------- body_left -------------------------/
/---------------------- body_center -------------------------/
.container .love {
width: 520px; /* 13 * 40 */
height: 440px; /* 11 * 40 */
left: 50%;
top: 50%;
position: absolute;
margin: -260px 0 0 -220px;
/background-color: gray;/
}
.love .block {
right: 0;
position: absolute;
visibility: hidden; /未开始升空动画前隐藏/
background-color: yellow;
}
.love .block div {
width: 40px;
height: 40px;
position: absolute;
background: url(“…/images/heart.png”) no-repeat;
background-size: contain;
/background-color: #c40908;/
/border: 1px solid silver;/
box-sizing: border-box;
}
/---------------------- body_center -------------------------/
/---------------------- footer -------------------------/
@keyframes border {
0% {
width: 0;
}
5% {
width: 5%;
}
10% {
width: 10%;
}
15% {
width: 15%;
}
20% {
width: 20%;
}
25% {
width: 25%;
}
30% {
width: 30%;
}
35% {
width: 35%;
}
40% {
width: 40%;
}
45% {
width: 45%;
}
50% {
width: 50%;
}
55% {
width: 55%;
}
60% {
width: 60%;
}
65% {
width: 65%;
}
70% {
width: 70%;
}
75% {
width: 75%;
}
80% {
width: 80%;
}
85% {
width: 85%;
}
90% {
width: 90%;
}
95% {
width: 95%;
}
100% {
width: 100%;
}
}
.footer {
bottom: 30px;
position: relative;
z-index: 99;
}
.footer .border .border-top {
/width: 0;/
/display: inline-block;/
border-top: 3px solid black;
transform-origin: left center;
-webkit-animation: border 312 linear;
-o-animation: border 12s linear;
animation: border 12s linear;
animation-fill-mode : both;
/border-bottom: none;/
}
.footer .border .border-bottom {
/width: 0;/
/display: inline-block;/
float: right;
border-top: 3px solid red;
transform-origin: right center;
-webkit-animation: border 7s linear 12s;
-o-animation: border 7s linear 12s;
animation: border 7s linear 12s;
animation-fill-mode : both;
/border-bottom: none;/
}
.footer .copyright {
width: 100%;
height: 30px;
position: absolute;
bottom: -30px;
text-align: center;
/background-color: gray;/
}
.copyright div {
width: 30%;
line-height: 30px;
display: inline-block;
}
.copyright div span {
color: dimgray;
}
/---------------------- footer -------------------------/
(2)love.js
const blk_pitn = { //各小方块相对【自身中心】的位置 – 【自身中心】确定为#div22的方块
block1: [[0, 1], [0, 0], [-1, 0], [-1, -1]],
block2: [[0, 1], [0, 0], [-1, 0], [0, -1]],
block3: [[-1, 1], [0, 0], [-1, 0], [-1, -1]],
block4: [[0, 1], [0, 0], [-1, 0], [-1, -1]], /* 1 */
block5: [[-1, 1], [0, 0], [-1, 0], [0, -1]],
block6: [[0, -1], [0, 0], [-1, 0], [1, -1]],
block7: [[-1, -1], [0, 0], [-1, 0], [1, 0]],
block8: [[-1, 1], [0, 0], [-1, 0], [-1, -1]], /* 3 */
block9: [[0, -1], [0, 0], [-1, 0], [1, 0]],
block10: [[-1, 1], [0, 0], [-1, 0], [1, 0]],
block11: [[2, 0], [0, 0], [-1, 0], [1, 0]], /* — */
block12: [[0, 1], [0, 0], [-1, 0], [0, -1]], /* 2 */
block13: [[0, 1], [0, 0], [-1, 0], [-1, -1]], /* 1 */
block14: [[1, 1], [0, 0], [-1, 0], [1, 0]],
block15: [[1, -1], [0, 0], [-1, 0], [1, 0]],
block16: [[-1, -1], [0, 0], [-1, 0], [1, 0]], /* 7 */
block17: [[0, 1], [0, 0], [-1, 0], [0, -1]], /* 2 */
block18: [[0, 1], [0, 0], [-1, 0], [-1, -1]], /* 1 */
block19: [[0, -1], [0, 0], [-1, 0], [1, 0]], /* 9 */
block20: [[1, -1], [0, 0], [-1, 0], [1, 0]],
block21: [[0, 1], [0, 0], [-1, 0], [-1, -1]], /* 1 */
block22: [[1, 1], [0, 0], [-1, 0], [1, 0]], /* 14 */
block23: [[0, 2], [0, 0], [0, -1], [0, 1]] /* | */
},
offset_pitn = { //各方块block相对【爱心中心】的位置
block1: [5, 3],
block2: [5, 1],
block3: [3, 4],
block4: [3, 2],
block5: [3, -1],
block6: [2, 5],
block7: [2, 1],
block8: [1, -1],
block9: [1, -3],
block10: [1, 2],
block11: [0, 3],
block12: [0, 0], /* 【爱心中心】*/
block13: [-1, -4],
block14: [0, -2],
block15: [-2, 4],
block16: [-2, 2],
block17: [-2, 0],
block18: [-3, -2],
block19: [-4, 0],
block20: [-3, 5],
block21: [-5, 3],
block22: [-4, 1],
block23: [-6, 1] /* 因动画需要移动一个方块,故y轴坐标-1*/
};
let blocks = document.getElementsByClassName(“block”),
block = blocks[0],
love = document.getElementsByClassName(“love”)[0],
timer = null,
index = 0, //记录拼接爱心的动画步骤
clone_block; //用于克隆方块
//1.移动方块的【自身中心】到【爱心中心】
block.style.top = “50%”;
block.style.left = “50%”;
block.style.margin = “-20px 0 0 -20px”;
const block_left = parseFloat(window.getComputedStyle(block, null).left.slice(0, -2)), //【爱心中心】 左边距离父元素的距离
block_top = parseFloat(window.getComputedStyle(block, null).top.slice(0, -2)); //【爱心中心】 顶部距离父元素的距离
function Next() {
if (++index >= 24) {
clearInterval(timer);
Rise();
// alert(“已经是最后一个了!”);
return;
}
最后
编程基础的初级开发者,计算机科学专业的学生,以及平时没怎么利用过数据结构与算法的开发人员希望复习这些概念为下次技术面试做准备。或者想学习一些计算机科学的基本概念,以优化代码,提高编程技能。这份笔记都是可以作为参考的。