Jump to content
GreenSock

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

GSAP v3 breaks animation

Recommended Posts

TimelineLite and TimelineMax both complain that staggerTo is no longer a property

and it breaks the animation.

 

Do I have to stick with v2.1.3 or is there a workaround for v3?

 

The Codepen link is original source. It is adapted to work with Ionic and Angular.

 

Multiple clicks on the play button will intentionally make it jitter.

 

Code:

 

```

export class PandaPage implements OnInit {
 
  master = new TimelineLite();
  tl = new TimelineLite();
 
  constructor() { }
 
  drawJellyPanda() {
    const tlPanda = new TimelineLite({ delay: .5 });
 
    tlPanda
 
      // SET
      .set('.svg-container', { perspective: 200 })
      .set('#panda', { transformOrigin: 'center' })
 
      // JELLYPANDA MOTION
      .staggerTo('#panda *'2, {
        scaleX: 1.2scaleY: .85y: -18rotationX: 15rotationY: -15rotationZ: 2,
        ease: Elastic.easeOut
      }, .0150.2)
      .staggerTo('#panda *'2, { scaleX: 1scaleY: 1y: 0rotationY: 0rotationX: 0rotationZ: 0ease: Elastic.easeOut }, .0150.4)
 
      // FACE MOVING LEFT
      .to('#face'.6, { x: -20rotationY: -20ease: Expo.easeOut }, 'b')
      .to('#head1'.6, { x: -14rotationY: -20ease: Expo.easeOut }, 'b')
      .to('#head2'.6, { x: -6rotationY: -15ease: Expo.easeOut }, 'b')
      .to('#ear1'.6, { y: 5rotationY: -20ease: Expo.easeOut }, 'b')
      .to('#ear2'.6, { y: 5rotationY: -20ease: Expo.easeOut }, 'b')
 
      // FACE MOVING RIGHT
      .to('#face'.6, { x: 20rotationY: 20ease: Expo.easeOut }, 'c+=.1')
      .to('#head1'.6, { x: 14rotationY: 25ease: Expo.easeOut }, 'c+=.1')
      .to('#head2'.6, { x: 6rotationY: 15ease: Expo.easeOut }, 'c+=.1')
      .to('#ear1'.6, { y: 5rotationY: 20ease: Expo.easeOut }, 'c+=.1')
      .to('#ear2'.6, { y: 5rotationY: 20ease: Expo.easeOut }, 'c+=.1')
 
      // PANDA BACK POSITION
      .to('#panda *'1.5, { x: 0y: 0rotationY: 0 }, '+=1')
 
    return tlPanda;
  }
 
  onComplete() {
    this.tl.clear().add(this.drawJellyPanda());
    this.master.play(0);
  }
 
  ionViewWillEnter() {
    // console.log('ionViewWillEnter - This function will be called every time you enter the view');
    this.drawJellyPanda();
  }
 
  ngOnInit() {
    // console.log('ngOnInit JellyPage');
  }
 
}

```

jelly-panda2.gif

See the Pen yNobEx by mrmoonrocket (@mrmoonrocket) on CodePen

Share this post


Link to post
Share on other sites

Like this.

 

.to('#panda *', {
  duration: 2,
  scaleX: 1.2, 
  scaleY: .85, 
  y: -18, 
  rotationX: 15, 
  rotationY: -15, 
  rotationZ: 2,
  ease: "elastic",
  stagger: 0.015
}, 0.2)
.to('#panda *', { 
  duration: 2,
  scaleX: 1, 
  scaleY: 1, 
  y: 0, 
  rotationY: 0, 
  rotationX: 0, 
  rotationZ: 0, 
  ease: "elastic", 
  stagger: 0.015 
}, 0.4)

 

More advanced stagger options.

 

See the Pen vYBRPbO by GreenSock (@GreenSock) on CodePen

 

Simplified easing using strings.

 

https://greensock.com/docs/v3/Eases

 

 

  • Like 3

Share this post


Link to post
Share on other sites

Hey Peter and welcome to the GreenSock forums!

 

As shown by Blake, staggers are included in all tweens as of GSAP 3! So you don't have to use clunky separate methods like .staggerTo any longer. I recommend reading the "Top 5 Features of GSAP 3" that covers this and other things.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×