Jump to content


Is it possible to change an array of target dynamically ?

Go to solution Solved by Rodrigo,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts


Like you'll see in the codepen, my array of target is not updated. Is there a solution to do that ?
Thank you guys :)


See the Pen MwBoJY by anon (@anon) on CodePen

Link to comment
Share on other sites

  • Solution

Hi and welcome to the GreenSock forums.


The behaviour you're seeing is completely expected. One of many implementations that makes GSAP super fast is avoiding continuous read-write operations. So once an instance have been instantiated all that info is stored for faster access to it. So once you change your array, that change has no effect on any instance created before the array was updated.


Something similar was in discussion not too long ago, check the following link, I believe you'll find some helpful information there:




Let us know if you need something else.


Happy Tweening!!

  • Like 3
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.