Spiderian Posted December 13, 2013 Share Posted December 13, 2013 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(); flake.y=-50; flake.x=randomRange(-10,1090); flake.alpha=0; addChild(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 More sharing options...
Spiderian Posted December 13, 2013 Author Share Posted December 13, 2013 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. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now