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);
}