javascript - Making Particle Explosion More Realistic in CreateJS -


my goal create semi-realistic particle effect, confetti explosion.

the issues i'm having currently:

  1. easing - i've tried multiple different easing effects, can't right. i'd imagine particles fly upwards quickly, hang @ top short time, fall slowly.
  2. too linear - particles move in obvious straight lines. there way make these seem they're moving along curved type path?
  3. rotation - want particles rotate bit, when add rotation tweens, seems rotate around weird origin point. how make particles rotate around centers?

working jsfiddle

i've been using gsap lot recently, wondering if there's way start tween in timeline before previous 1 ends?

function init(){      var canvas = document.getelementbyid('canvas'),         stage = new createjs.stage(canvas);      var colors = [       '#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5',       '#2196f3', '#03a9f4', '#00bcd4', '#009688', '#4caf50',       '#8bc34a', '#cddc39', '#ffeb3b', '#ffc107', '#ff9800',       '#ff5722', '#795548'     ];      (i=0;i<300;i++){       var particlesize = math.floor(math.random() * 14) + 4;        var particle=new createjs.shape();       particle.graphics.beginfill(colors[math.floor(math.random() * 17) + 1 ]).drawrect(         math.floor(math.random() * 101) - 50 + canvas.width/2 - (particlesize/2),  // x         math.floor(math.random() * 101) - 50 + canvas.height/2 - (particlesize/2),  // y         particlesize, // w         particlesize  // h       );        stage.addchild(particle);       stage.update();        var timemove = math.floor(math.random() * 800) + 600,           timefall = math.floor(math.random() * 1600) + 300,            movex = particle.x + math.floor(math.random() * 401) - 200,           movey = particle.y - math.floor(math.random() * 200) + 1,           fally = particle.y - math.floor(math.random() * 400) + 1;        createjs.tween.get(particle, {loop: false})         .to({x: movex, y: movey }, timemove, createjs.ease.quadout)         .to({x: movex + (movex/1.2), y: 600 }, timefall, createjs.ease.quadin);     }      createjs.ticker.setfps(60);     createjs.ticker.addeventlistener("tick", stage); }  init(); 


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -