admin 管理员组文章数量: 1184232
2023年12月16日发(作者:aspirations是什么意思)
(new Crown(this, this.x, this.y)); } }, { key: 'addParticle', value: function addParticle() { (new Particle(this, this.x, this.y)); } }, { key: 'removeObject', value: function removeObject( obj) { var index = f(obj); if (index !== -1) { (index, 1); } } }]);return Explosion;}();// World
varConfettiWorld = function () {function ConfettiWorld()
{_classCallCheck(this, ConfettiWorld);}_createClass(ConfettiWorld, [{ key: 'init', value: function init() { s = []; ntListener('click', (this)); // Initial explosion //初始爆炸 var counter = 0; while (counter-- > 0) { e({ clientX: X, //getRandomInt(10, ) , // / 2, clientY: Y //getRandomInt(10, 50) // / 2
}); } } }, { key: 'update', value: function update( dt) { h(function (obj) { if (obj) (dt); }); var amount = (function (sum, explosion) { return sum += ; }, 0); } }, { key: 'render', value: function render( ctx) { h(function (obj) { if (obj) (ctx); }); } }, { key: 'explode', value: function explode( event) { var x = X; var y = Y; (new Explosion(this, x, y)); } }, { key: 'clearExplosion', value: function clearExplosion( explosion) { var index = f(explosion); if (index !== -1) { (index, 1);
} } }]);return ConfettiWorld;}();// TimevarTime = function () { function Time() {_classCallCheck(this, Time); = 0; // current tick time = 0; // prev tick time d = 0; // elapsed time from last tick = 0; // time from last update = 60; // desired fps = 1 / 60; // step duration }_createClass(Time, [{ key: 'update', value: function update( time) { = time; d = ( - ) / 1000; = ; += d; } }, { key: 'raf', value: function raf( func) { tAnimationFrame(func); } }, { key: 'hasFrames', value: function hasFrames() { return >= ; } }, { key: 'processFrame', value: function processFrame() { -= ; } }]);return Time;}();// CanvasvarUniverse = function () { function Universe(element) {_classCallCheck(this, Universe); = element; = text('2d'); atio = PixelRatio; = new Time(); = {}; = null; // current state Size(); ntListener('resize', (this)); ld('confetti', ConfettiWorld); ld('confetti'); (); }_createClass(Universe, [{ key: 'start', value: function start() { ((this)); } }, { key: 'tick', value: function tick(
time) { (time); if (mes()) { (); sFrame(); } (); ((this)); } }, { key: 'update', value: function update() { (); } }, { key: 'render', value: function render() { var gradient = LinearGradient(0, 0, , ); ect(0, 0, , ); (); } // Helpers 库 }, { key: 'updateSize', value: function updateSize() { = idth; = eight; = * atio; = * atio; = idth + 'px'; = eight + 'px'; (atio, atio); } }, { key: 'addWorld', value: function addWorld( worldName, World) { [worldName] = new World(); [worldName].universe = this; [worldName].init(); } }, { key: 'setWorld', value: function setWorld( worldName) { = [worldName]; } }]);return Universe;}();// ();var element = elector('#canvas1');= new Universe(element);
版权声明:本文标题:酷炫一款动态背景(HTML+jscanvas) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1702731756a428477.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论