html 萤火虫特效,html5+CSS3杯子里萤火虫发光动画特效

html5+CSS3杯子里萤火虫发光动画特效

js代码

var numP = 50;

TweenMax.set("#content", {transformOrigin:"50% -45%"})

//TweenMax.fromTo("#particles", .7, {background:'rgb(16,17,24)'}, {background:'rgb(18,15,23)', repeat:-1, yoyo:true, ease:Elastic.easeInOut})

for (var i = 0; i<=numP; i++) {

if (i==0){

TweenMax.set("#p0", {scale:0})

//loop(document.getElementById('p0'), 0);

}

else {

var _p = document.getElementById('p0').cloneNode(false);

_p.id = "p" + i;

document.getElementById('particles').appendChild(_p);

TweenMax.fromTo(_p, 13, {

x:120+110*Math.random(),

y:200+250*Math.random(),

scale:3*Math.random()

},{

bezier:{ type:'thru', values:[

{x:99+60*Math.random(), y:50+100*Math.random(), scale:.5+Math.random(), alpha:1},

{x:40+80*Math.random(), y:200+160*Math.random(), scale:3-Math.random(), alpha:0.25},

{x:60+60*Math.random(), y:390+50*Math.random(), scale:3*Math.random(), alpha:.7+.3*Math.random()}],

},

onComplete:loop,

onCompleteParams:[_p],

ease:Sine.easeInOut

}).progress(i/numP)

}

}

function loop(_p){

var tl = new TimelineMax({yoyo:true, repeat:-1})

//.to(_p, 3, {x:100+50*Math.random(), y:380+50*Math.random(), scale:1+2*Math.random(), ease:Linear.easeNone}, 0)

.to(_p, 14, {

ease:Sine.easeInOut,//Linear.easeNone,

bezier:{ type:'thru', values:[

{x:190+30*Math.random(), y:100+60*Math.random(), scale:3-Math.random()},

{x:190+50*Math.random(), y:150+100*Math.random(), scale:.5+Math.random(), alpha:1},

{x:190-60*Math.random(), y:200+160*Math.random(), scale:3-Math.random(), alpha:0.25},

{x:200-70*Math.random(), y:390+50*Math.random(), scale:3*Math.random(), alpha:1}],

}})

}

window.addEventListener('mousemove',function(e){

TweenMax.to("#content", .5, {x:-400+800*(e.clientX/window.innerWidth), rotation:-25+50*(e.clientX/window.innerWidth)})

})

申明:本站所有资源都是转载各大下载站,或由网友投稿发布,请自行检测软件的完整性,如有侵权请联系我们删除下架,联系方式:admin@php.cn

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值