Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
jonForum

TimelineLite with null target ?

Recommended Posts

am experimenting with timeLine

Exist a way to add a simple instance with callback but without target ?

 

        const actiontl = new TimelineLite();
actiontl.to(items, 0.2, {x:'+=140',y:'-=140', ease: Power4.easeOut },'#step1')
        .to(items.map(i => i.scale), 0.3, {x:0.8,y:0.8, ease: Elastic.easeOut.config(1, 0.3) },'#step1')
        .to(items, 0.1, {x:target.p.x ,y:target.p.y-(target.p.height/2), ease: Back.easeIn.config(1) } )
        .to(null, 0, { onStart: () => { target.s.state.setAnimation(1, "hit1", false) } } ) //FIXME NO WORK !
        .from(items.map(i => i.scale), 0.3, {x:2,y:2, ease: Power4.easeOut } ,'#hit')
        .from(items, 0.3, {rotation:4, ease: Power4.easeOut } ,'#hit')
        .to(items, 1, {x:'-=100' ,y:'-=150', ease: Expo.easeOut },'#hit' )
        .to(items, 0.6, {x:'-=15' ,y:target.p.y, ease: Bounce.easeOut } )


So example here .to(null, 0, { onStart: () => { target.s.state.setAnimation(1, "hit1", false) } } )

i found more readable to split my event from animation, but i get 

"Cannot tween a null target.";


So if i understand we can no work like this , i need to add the event callback onStart in a valide timeline with target ?
Or existe a way to use a empty timeline with only a event ?

thanks

Link to post
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.

×