Jump to content


Particle animation to different layers.

Recommended Posts

I want to duplicate my snow animation and fit it between the two layers I have set up. This way I will have a foreground snow and a background snow. So I want to keep my current snow on top and make a duplicate layer of it between MC_BG and MC_FG. I tried wrapping the snow in a function and adding it as a child at level 1, but I probably did it wrong. Any Help will be appreciated.

import com.greensock.*;
import com.greensock.easing.*;

addChildAt(MC_BG, 0)
addChildAt(MC_FG, 2)

var tl:TimelineMax=new TimelineMax({paused:false});

function createFlake(offset) {
//create a flake (attach symbol in library with Class flake) and position on stage
var flake:Flake = new Flake();

//create timeline for each flake
var nestedTl:TimelineMax = new TimelineMax();

//how much wiggling / zig zagging
var wiggle:Number=randomRange(15,35);
//zig or zag?
wiggle=Math.random() > .5?- wiggle:wiggle;
//how fast and big
var speed:Number=randomRange(5,15);
//fade and grow
nestedTl.insert(TweenMax.to(flake, .5, {alpha:randomRange(.5,1), scaleX:speed, scaleY:speed}));
//go down
nestedTl.insert(TweenMax.to(flake,speed, {y:800}));
//zig zag
nestedTl.insert(TweenMax.to(flake, speed*.15, {x:String(wiggle), repeat:Math.floor(randomRange(1,4)), yoyo:true, ease:Sine.easeInOut}));

tl.insert(nestedTl, offset);
Link to comment
Share on other sites

I figured it out. It was easy. I put slightly varied versions of this code in blank Move Clips. Then I just slapped them on layers in between my foreground, mid-ground and background. It worked awesomely.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.