Jump to content
Search Community

Targeting Array of IDs - GSAP 3.0

Parrot Puppet test
Moderator Tag

Recommended Posts

Hey Mr. GreenSock,

 

Converting over to GSAP 3.0 but am a little confused how to target an array of elements when Tweening.

 

Here is the way I used to be able to do it,
TweenMax.to([green, orange, grey],  1,  {rotation: 27,  x: 100});

But this no longer seems to work

 

Any helpful hints to targeting multiple elements?

See the Pen xxxNMyJ?editors=1111 by John_Joe_Parrott (@John_Joe_Parrott) on CodePen

Link to comment
Share on other sites

You are using variable, just use string instead.


gsap.to(['.green', '.orange', '.grey'], {rotation: 27, x: 100, duration: 1});

 

or without the array :

 

gsap.to('.green, .orange, .grey', {rotation: 27, x: 100, duration: 1});

  • Like 4
  • Thanks 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.
×
×
  • Create New...