Jump to content

Returns : *

The tween or timeline associated with the given ID. Returns undefined if no tween or timeline has that ID.


When creating a tween or timeline you can assign it an ID to use. Then later you can refer to it using that ID. This is particularly helpful when using frameworks and build tools like React where keeping track of variables can be difficult.

  1. gsap.to(obj, {id: "myTween", duration: 1, x: 100});
  2. //later
  3. gsap.getById("myTween"); //returns the tween

Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.