Jump to content
Search Community

tilohi8071

Members
  • Posts

    4
  • Joined

  • Last visited

tilohi8071's Achievements

  1. Hello, I have an animation where several elements move synchronously to a random position. To ensure that they both receive the same random value, I generate it in onRepeat. I want to make the animation adaptive. If you change the screen width now, you will notice how the elements "jump" to new position. To fix this, I assume that when resizing, the updateX function should use the old random value. However, for some reason, onRepeat is triggered during every tick of the resize event, and I don't understand how to determine when to update the lastRand value and when to use the old one.
  2. Hi there, I need a simple animation: An element moves towards its starting point (x: 500), then for some time, this value changes randomly every second, and after about 10 seconds, the element moves towards its final point (x: 1000). I tried to do this using the repeat property and chain calls, but it didn't work out well. Here's an example implementation using setTimeout and setInterval. Can someone help me refactor this using gsap properties and methods?
×
×
  • Create New...