Jump to content
Search Community

felipejorge

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by felipejorge

  1. Hi,

     

    I have an infinite animation I want to do (think of rainfall). After it reaches the halfway mark I want to randomly pick between green and red to change the background color, and then when it loops back to  the top, it goes back to the original grey color. 

     

    I already have this going which simulates the infinite "rainfall". I just can't figure out how to change the bg color of the circle at the halfway mark

     

      gsap.to(droplet, {
            duration: duration,
            y: 620,
            delay: delay,
            repeat: -1,
            modifiers: {
              y: gsap.utils.unitize(x => parseFloat(x) % 620) //force x value to be between 0 and 500 using modulus
            },
            ease: "none"
          });

     

     

    This is the desired effect:

    394672361_ScreenShot2021-10-07at14_26_27.thumb.png.404ed9aefd36dd44b36ca113a1d52dfe.png

    See the Pen gOxYbOj by felipejorge7 (@felipejorge7) on CodePen

×
×
  • Create New...