nss5161 Posted March 24, 2021 Share Posted March 24, 2021 Hi Forum! In this pen example, I have created two timelines that are to loop infinitely. One timeline controls the shape morph and opacity of the flame, and the other timeline is to control the eye movement. Focusing on the Issue... In the second timeline (Scene2: The eyes), the "tl2.to" function calls the custom function "getRandomValues(min, max)" that I have created below. When I console log a test value in the function call, I am seeing a duplicate value every call. You can replicate this issue by opening the console log in your browser or in CodePen depending on your preference. I have altered the function and the timeline criteria with no attempt to fix the issue. Can you please assist me with this issue? Please ask questions if I have not explained well! I will reply as soon as possible. tl2.to(".pupil", { duration: 0.1, ease: "linear", x: function(){ console.log("test"); return getRandomValue(-2, 2); } }); function getRandomValue(min, max) { return (Math.random() * (max - min) + min).toFixed(1); } See the Pen oNYQZzV?editors=1010 by nss5161 (@nss5161) on CodePen Link to comment Share on other sites More sharing options...
PointC Posted March 24, 2021 Share Posted March 24, 2021 I don't have time to look at all the code at the moment, but just FYI - you can use this in your tl2 timeline. x: "random(-2, 2, 1)" More info about the GSAP 3 random utility method. https://greensock.com/docs/v3/GSAP/UtilityMethods/random() Happy tweening. 3 Link to comment Share on other sites More sharing options...
Solution GreenSock Posted March 24, 2021 Solution Share Posted March 24, 2021 You're right about the repeatRefresh getting triggered twice when applied to a timeline - thanks for pointing that out @nss5161. It should be resolved in the next release which you can preview at https://assets.codepen.io/16327/gsap-latest-beta.min.js 3 Link to comment Share on other sites More sharing options...
PointC Posted March 24, 2021 Share Posted March 24, 2021 It's really cool how fast bugs like a double repeatRefresh get fixed around here. It's really cool how fast bugs like a double repeatRefresh get fixed around here. 1 2 Link to comment Share on other sites More sharing options...
akapowl Posted March 24, 2021 Share Posted March 24, 2021 5 minutes ago, PointC said: It's really cool how fast bugs like a double repeatRefresh get fixed around here. It's really cool how fast bugs like a double repeatRefresh get fixed around here. I'd fix that for you, but then nobody would have the chance to get a laugh at that 😅 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now