l: [], start: function(t, e, s) { shakes.ropeH = t, shakes.container = e, shakes.timer = setInterval(function() { shakes.spawn(getRadian(s)), shakes.update() }, 50) }, spawn: function(t) { if (! (shakes.pool.length >= shakes.MAX_PARTICLES)) { var e = Math.sin(t) * (shakes.ropeH + 40), s = Math.cos(t) * (shakes.ropeH + 40) + 20; heart = new TinyHeart(e, s, shakes.container), shakes.pool.push(heart) } }, update: function() { var t, e; for (t = shakes.pool.length - 1; t >= 0; t--) e = shakes.pool[t], e.alive ? e.move() : (e.destory(), shakes.pool.splice(t, 1)) }, stop: function() { clearInterval(shakes.timer), shakes.pool.forEach(function(t) { t.destory() }), shakes.pool = [] } }, init = function() { var t = 180, e = document.querySelector("#valentine"), s = e.querySelector(".tiny"), a = e.querySelector(".shake"), i = function() { e.querySelector(".close").addEventListener("click", function() { shakes.stop(), e.style.display = "none" }) }; shakes.start(t, s, a), a.querySelector(".rope").style.height = t + "px", a.querySelector(".heart-wrap").style.top = t - 60 + "px", e.style.display = "block", i() }; init();
效果图:
4、jQuery+HTML5实现唯美表白动画代码
这是一个很小的jQuery+HTML5静态页面,是一位程序员用来庆祝跟mm相恋一周年纪念日。同时也为了以程序员的视角来表达浪漫,改变大家对于程序员先入为主的形象,程序员改变世界~
效果图:
5、情人节送花动画HTML5特效
HTML5情人节送花表白放烟花动画特效,小伙子走进花店买花,然后把玫瑰花送到姑娘手上,姑娘接过花然后两个人一起看烟花,非常浪漫的一个HTML5动画,不止适合情人节表白使用,平时表白也可以用的。
部分代码:
<div id='content'> <ul class='content-wrap'> <!-- 第一副画面 --> <li> <!-- 背景图 --> <div class="a_background"> <div class="a_background_top"></div> <div class="a_background_middle"></div> <div class="a_background_botton"></div> </div> <!-- 云 --> &nb |