2024年2月7日发(作者:)

//按位取反运算符return ~~((()*(rMa-rMi+1))+rMi);},hitTest = function(x1, y1, w1, h1, x2, y2, w2, h2){return !(x1 + w1 < x2 || x2 + w2 < x1 || y1 + h1 < y2 || y2 + h2 < y1);};//请求动画帧tAnimFrame=function(){return tAnimationFrame||RequestAnimationFrame||uestAnimationFrame||stAnimationFrame||estAnimationFrame||function(callback){eout(callback,1000/60);}}(); = function(){ = Element('canvas');//canvas 全屏 = = $(window).innerWidth(); = = $(window).innerHeight();les = [];unt = 150;rks = []; = /2; = /2;tHue = 30;eed = 5;eedVariance = 10;nd = 50;iction = 5;avity = 1; = 0; = 360;

hitX: false,hitY: false,coordLast: [{x: startX, y: startY},{x: startX, y: startY},{x: startX, y: startY}],targetX: targetX,targetY: targetY,speed: peed,angle: 2(targetY - startY, targetX - startX),shockwaveAngle: 2(targetY - startY, targetX - startX)+(90*(/180)),acceleration: ccel/100,hue: tHue,brightness: rand(50, 80),alpha: rand(50,100)/100,lineWidth: dth};(newFirework);};// 更新烟花Fireworks = function(){var i = ;while(i--){var f = rks[i];dth = dth;vx = () * ,vy = () * ; *= 1 + ration;ast[2].x = ast[1].x;ast[2].y = ast[1].y;ast[1].x = ast[0].x;ast[1].y = ast[0].y;ast[0].x = f.x;

ast[0].y = f.y;if( >= X){if(f.x + vx <= X){ff.x = X; = true;} else {f.x += vx;}} else {if(f.x + vx >= X){ff.x = X; = true;} else {f.x += vx;}}if( >= Y){if(f.y + vy <= Y){ff.y = Y; = true;} else {f.y += vy;}} else {if(f.y + vy >= Y){ff.y = Y; = true;} else {f.y += vy;}}if( && ){Particles(X, Y, );(i, 1);

}};};// 绘制烟花reworks = function(){var i = ;CompositeOperation = 'lighter';while(i--){var f = rks[i];dth = dth;var coordRand = (rand(1,3)-1);ath();((ast[coordRand].x), (ast[coordRand].y));((f.x), (f.y));ath();Style = 'hsla('++', 100%, '+ness+'%, '++')';();if(rget){();ath();((X), (Y), rand(1,8), 0, *2, false)ath();dth = 1;();e();}if(ockwave){();ate((f.x), (f.y));(aveAngle);ath();(0, 0, 1*(/5), 0, , true);Style = 'hsla('++', 100%, '+ness+'%, '+rand(25, 60)/100+')';dth = dth;

();e();}};};// 绑定事件ents = function(){$(window).on('resize', function(){clearTimeout(t);t = setTimeout(function() { = = $(window).innerWidth(); = = $(window).innerHeight();p = 'round';in = 'round';}, 100);});$().on('mousedown', function(e){ = - Left; = - Top;tHue = rand(, );Fireworks(/2, , , );$().on('rks', function(e){ = - Left; = - Top;tHue = rand(, );Fireworks(/2, , , );});});$().on('mouseup', function(e){$().off('rks');});}; = function(){les = [];