Copy link to clipboard
Copied
Hi,
I have created a simple movieclip with a fireworks explosion, and added a "this.stop" in the end of the clip.
Now I would like this clip to be played randomly in the background of my webbanner. I can easely add it myself to the stage on various positions on the timepline multiple times and play it, but there must be a more simle way to script this?
The clips needs to be randomly scaled as well.
Another really alternative is using javascript / createjs to draw all particles, there are som really cool stuff people make with css/js in tutorials, but I dont know how to implement these features in Adobe Animate.
Best regards,
Mikkel Svensson
Copy link to clipboard
Copied
assign a linkage id (eg, MC), adjust parameters (timing, position, scaling) and use:
var mc;
var counter = 10*Math.random();
createjs.Ticker.addEventListener("tick",f.bind(this));
function f(){
if(createjs.Ticker.getTicks()>counter){
mc = new lib.MC();
mc.x = Math.random()*(stage.canvas.width-50);
mc.y = Math.random()*(stage.canvas.height-50);
mc.scaleX = mc.scaleY *= Math.random();
this.addChild(mc);
counter = createjs.Ticker.getTicks()+ 10*Math.random();
}
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more