Jump to content
Search Community

onRepeat not working right

bethios test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I will master the onRepeat one day! 

 

I'm trying to make ingredients fall and then vanish when they do before they repeat again (so they aren't all just chilling at the bottom of my screen)

    function erase(){
        TweenLite.set(this, {
            scale: 0
        });
    }

 

    var food = ['.meat', '.pepper', '.nori', '.toppings']


    for(var i = 0; i < food.length; i++ ){
        ing.to(food, 1, {
            rotation: 360, 
            x: '+=30',
            y: yTo,
            scale: 1,
            repeat: -1, 
            repeatDelay: time * food.length,
            ease: Power1.easeIn,
            onRepeat: erase
        }, time * i ,'start');
    }

 

Is it that the onRepeat doesn't fire until after the repeatDelay? Would it be smarter to just use a staggerTo?  

Link to comment
Share on other sites

Here's basically what I'm trying to achieve

1) First item in array falls. 

2) When it completes the fall it vanishes

3) It waits until all the other items have fallen in their turns to fall again

 

help?

Link to comment
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.
×
×
  • Create New...