Random fireworks effect

Community Beginner ,
Dec 15, 2020 Dec 15, 2020

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

Views

48

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

LATEST

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();
}
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines