时间:2023-07-24 05:51:02 | 来源:网站运营
时间:2023-07-24 05:51:02 来源:网站运营
520七夕情人节表白代码~html+css+javascript实现樱花爱心相册「可以拿去送给自己喜欢的人」:一年一度的/520情人节/七夕情人节/生日礼物/告白师妹/圣诞节/元旦节跨年/程序员表白
,是不是要给女朋友或者正在追求的妹子一点小惊喜呢,今天这篇博客就分享下前端代码html+css+javascript 如何实现3D立体动态相册。赶紧学会了,来制作属于我们程序员的浪漫吧!<html> <head> <title></title> </head> <style> * { padding: 0; margin: 0; } html, body { height: 100%; padding: 0; margin: 0; background: #000; } canvas { position: absolute; width: 100%; height: 100%; } .aa { position: fixed; left: 50%; bottom: 10px; color: #ccc; } </style> <body> <canvas id="pinkboard"></canvas> </body>
<script> /* * Settings */ var settings = { particles: { length: 500, // maximum amount of particles duration: 2, // particle duration in sec velocity: 100, // particle velocity in pixels/sec effect: -0.75, // play with this for a nice effect size: 30, // particle size in pixels }, }; /* * RequestAnimationFrame polyfill by Erik M?ller */ (function () { var b = 0; var c = ["ms", "moz", "webkit", "o"]; for (var a = 0; a < c.length && !window.requestAnimationFrame; ++a) { window.requestAnimationFrame = window[c[a] + "RequestAnimationFrame"]; window.cancelAnimationFrame = window[c[a] + "CancelAnimationFrame"] || window[c[a] + "CancelRequestAnimationFrame"]; } if (!window.requestAnimationFrame) { window.requestAnimationFrame = function (h, e) { var d = new Date().getTime(); var f = Math.max(0, 16 - (d - b)); var g = window.setTimeout(function () { h(d + f); }, f); b = d + f; return g; }; } if (!window.cancelAnimationFrame) { window.cancelAnimationFrame = function (d) { clearTimeout(d); }; } })(); var Point = (function () { function Point(x, y) { this.x = typeof x !== "undefined" ? x : 0; this.y = typeof y !== "undefined" ? y : 0; } Point.prototype.clone = function () { return new Point(this.x, this.y); }; Point.prototype.length = function (length) { if (typeof length == "undefined") return Math.sqrt(this.x * this.x + this.y * this.y); this.normalize(); this.x *= length; this.y *= length; return this; }; var Particle = (function () { function Particle() { this.position = new Point(); this.velocity = new Point(); this.acceleration = new Point(); this.age = 0; } Particle.prototype.initialize = function (x, y, dx, dy) { this.position.x = x; this.position.y = y; this.velocity.x = dx; this.velocity.y = dy; this.acceleration.x = dx * settings.particles.effect; this.acceleration.y = dy * settings.particles.effect; this.age = 0; }; Particle.prototype.update = function (deltaTime) { this.position.x += this.velocity.x * deltaTime; this.position.y += this.velocity.y * deltaTime; this.velocity.x += this.acceleration.x * deltaTime; this.velocity.y += this.acceleration.y * deltaTime; this.age += deltaTime; };
.box { width: 200px; height: 200px; background-size: cover; background-repeat: no-repeat; background-attachment: fixed; background-size: 100% 100%; position: absolute; margin-left: 42%; margin-top: 22%; -webkit-transform-style: preserve-3d; -webkit-transform: rotateX(13deg); -webkit-animation: move 5s linear infinite;}.minbox li:nth-child(1) { background: url(../img/01.png) no-repeat 0 0; -webkit-transform: translateZ(50px);}.minbox li:nth-child(2) { background: url(../img/02.png) no-repeat 0 0; -webkit-transform: rotateX(180deg) translateZ(50px);}.minbox li:nth-child(3) { background: url(../img/03.png) no-repeat 0 0; -webkit-transform: rotateX(-90deg) translateZ(50px);}.minbox li:nth-child(4) { background: url(../img/04.png) no-repeat 0 0; -webkit-transform: rotateX(90deg) translateZ(50px);}.minbox li:nth-child(5) { background: url(../img/05.png) no-repeat 0 0; -webkit-transform: rotateY(-90deg) translateZ(50px);}.minbox li:nth-child(6) { background: url(../img/06.png) no-repeat 0 0; -webkit-transform: rotateY(90deg) translateZ(50px);}.maxbox li:nth-child(1) { background: url(../img/1.png) no-repeat 0 0; -webkit-transform: translateZ(50px);}.maxbox li:nth-child(2) { background: url(../img/2.png) no-repeat 0 0; -webkit-transform: translateZ(50px);}.maxbox li:nth-child(3) { background: url(../img/3.png) no-repeat 0 0; -webkit-transform: rotateX(-90deg) translateZ(50px);}.maxbox li:nth-child(4) { background: url(../img/4.png) no-repeat 0 0; -webkit-transform: rotateX(90deg) translateZ(50px);}.maxbox li:nth-child(5) { background: url(../img/5.png) no-repeat 0 0; -webkit-transform: rotateY(-90deg) translateZ(50px);}.maxbox li:nth-child(6) { background: url(../img/6.png) no-repeat 0 0; -webkit-transform: rotateY(90deg) translateZ(50px);}.maxbox { width: 800px; height: 400px; position: absolute; left: 0; top: -20px; -webkit-transform-style: preserve-3d;}.maxbox li { width: 200px; height: 200px; background: #fff; border: 1px solid #ccc; position: absolute; left: 0; top: 0; opacity: 0.2; -webkit-transition: all 1s ease;}.maxbox li:nth-child(1) { -webkit-transform: translateZ(100px);}.maxbox li:nth-child(2) { -webkit-transform: rotateX(180deg) translateZ(100px);}.maxbox li:nth-child(3) { -webkit-transform: rotateX(-90deg) translateZ(100px);}.maxbox li:nth-child(4) { -webkit-transform: rotateX(90deg) translateZ(100px);}.maxbox li:nth-child(5) { -webkit-transform: rotateY(-90deg) translateZ(100px);}.maxbox li:nth-child(6) { -webkit-transform: rotateY(90deg) translateZ(100px);}
mp3
背景音乐,可自行下载更换即可~ mp3免费下载地址 1.搜索需要的歌曲关键词:相册,樱花,表白,七夕,实现