Jump to content


Random values on each timeline repeat

Recommended Posts

Is it possible to refresh random values on every repeat of a timeline?


I have the the random values on each tween creation, but it just loops the same values.  

See the Pen BaLyqbb by garethj (@garethj) on CodePen

Link to comment
Share on other sites

Hey @gareth


repeatRefresh might be what you're looking for


See the Pen 7bc9f4a88180f4a147869a0e8f7e6153 by akapowl (@akapowl) on CodePen


repeatRefresh Setting repeatRefresh: true causes a repeating timeline to invalidate() all of its child tweens and re-record their starting/ending values internally on each full iteration (not including yoyo's). This is useful when you use dynamic values (relative, random, or function-based). For example, x: "random(-100, 100)" would get a new random x value on each repeat. duration, delay, and stagger do NOT refresh.


(from the docs)

  • Like 6
Link to comment
Share on other sites

ok wow, so simple - thank you ! 

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