Jump to content
GreenSock

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

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 post
Share on other sites

Hey @gareth

 

repeatRefresh might be what you're looking for

 

See the Pen wvzBYLb 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 4
Link to post
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.

×