Jump to content
GreenSock

mikecorbridge

modules

Recommended Posts

This question has probably been asked, but my searches have not turned up anything of value yet.

 

Basically I have an animation sequence that will be used on multiple timelines.  Is there a way to 'package' a unique timeline and apply it to others?  An example I might come up with is the flapping of a birds wings (I'm not writing that btw).  The sequence I might use to flap the wings could be generally applied to a number of wing images, and bird bodies.  

 

Apologies in advance if this noob question has already been addressed. 

Link to comment
Share on other sites

Hi mikecorbridge  :)

 

pls try this : 

See the Pen OPeqVR by MAW (@MAW) on CodePen

function anim(elem){  
  var tl = new TimelineMax();
  tl.to(elem,1,{.............})
    .to(elem,1,{........})
  return tl
};

var master1 = new TimelineMax();
master1.to( '#mydiv1' , 0.5 , {rotation:360})
  .add( anim( '#mydiv1' ) ) // now you can call anim() with any selector and add in other timelines
  .add( anim( '#mydiv2' ) ); 
  • Like 2
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.
×