Jump to content
Search Community

jomifo

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by jomifo

  1. Thanks Jack, I didn't read the docs thoroughly enough- using endX and endY solves my use case perfectly.  I think I was presuming Greensock would not even instantiate a throw tween if the movement was so minuscule and because of that there would be a higher-level api abstraction that could be called in onDragEnd to determine if Greensock triggered the throw or not.  But doing the calculations with endX, endY works for me.

  2. Hi Carl-

     

    No worries and thanks for the workaround.  It's cleaner to me than declaring all the tween instances.  Also, I verified it works for me.

     

    I encounter this type of animation fairly frequently when porting over Flash animations from old-school animators.  They use a variable delay between multiple "particle-effect" flicker animations that are the same and then loop the whole thing.  This gives a randomness to the "flicker".  Also, they usually add a bit of actionscript on frame 1 so that the initial start of the animation is on a different frame for each "particle".  Something which I'm happy I can easily do with greensock by passing a from value to play().

     

    jomifo

  3. oddly, if I assign the children tweens to variables before adding to the timeline things work as expected and the number of children for the parent timeline is three as I would expect.

     

            this.glowTimeline = new TimelineMax();
            this.glowTimeline.set(this.sparkleGlowScale, {x: 0.21, y: 0.21});
            this.glowTimeline.set(this.sparkleGlow, {alpha: 0.0});
            this.glowTimeline.set(this.sparkleGlow, {setVisible: true});
            this.glowTimeline.to(this.sparkleGlowScale, 0.25, {x: 1, y: 1, ease: Quad.easeOut}, 0);
            this.glowTimeline.to(this.sparkleGlow, 0.25, {alpha: 1.0, ease: Quad.easeOut}, 0);
            this.glowTimeline.to(this.sparkleGlowScale, 0.67, {x: 0.21, y: 0.21, ease: Quad.easeIn}, 0.25);
            this.glowTimeline.to(this.sparkleGlow, 0.67, {alpha: 0.0, ease: Quad.easeIn}, 0.25);
    
    
            var tw1 = this.glowTimeline.tweenFromTo(0, this.glowTimeline.duration());
            var tw2 = this.glowTimeline.tweenFromTo(0, this.glowTimeline.duration());
            var tw3 = this.glowTimeline.tweenFromTo(0, this.glowTimeline.duration());
            this.glowRepeatTimeline = new TimelineMax();
            this.glowRepeatTimeline.repeat(-1);
            this.glowRepeatTimeline.repeatDelay(2.58);
            this.glowRepeatTimeline.add(tw1, 0.0);
            this.glowRepeatTimeline.add(tw2, 3.6667);
            this.glowRepeatTimeline.add(tw3, 6.1667);
            console.log(this.glowRepeatTimeline.getChildren());
     
  4. Thanks for the reply.

     

    Still does not seem to work for me.

     

    Strangely, when I log out the children of the glowRepeatTimeline, there is only one element in the array.  I would expect three.

     

    Here is the code,

            this.glowTimeline = new TimelineMax();
            this.glowTimeline.set(this.sparkleGlowScale, {x: 0.21, y: 0.21});
            this.glowTimeline.set(this.sparkleGlow, {alpha: 0.0});
            this.glowTimeline.set(this.sparkleGlow, {setVisible: true});
            this.glowTimeline.to(this.sparkleGlowScale, 0.25, {x: 1, y: 1, ease: Quad.easeOut}, 0);
            this.glowTimeline.to(this.sparkleGlow, 0.25, {alpha: 1.0, ease: Quad.easeOut}, 0);
            this.glowTimeline.to(this.sparkleGlowScale, 0.67, {x: 0.21, y: 0.21, ease: Quad.easeIn}, 0.25);
            this.glowTimeline.to(this.sparkleGlow, 0.67, {alpha: 0.0, ease: Quad.easeIn}, 0.25);
    
    
            this.glowRepeatTimeline = new TimelineMax();
            this.glowRepeatTimeline.repeat(-1);
            this.glowRepeatTimeline.repeatDelay(2.58);
            this.glowRepeatTimeline.add(this.glowTimeline.tweenFromTo(0, this.glowTimeline.duration()), 0);
            this.glowRepeatTimeline.add(this.glowTimeline.tweenFromTo(0, this.glowTimeline.duration()), 3.67);
            this.glowRepeatTimeline.add(this.glowTimeline.tweenFromTo(0, this.glowTimeline.duration()), 6.17);
            console.log(this.glowRepeatTimeline.getChildren());

    Thanks for any insight.

  5. In Javascript, I have a timeline that I want to repeat indefinitely, but want to delay the repeat with a different value every time(actually the same delay every third time) and then repeat the sequence over and over again.  This is how it is represented on a Flash moveclip timeline-

     post-33638-0-16258900-1420735578_thumb.png

     

    First approach using a parent timeline. This did not work-

    var parentTimeline = new TimelineMax({repeat: -1, repeatDelay: 2.58});
    parentTimeline.add(timelineToRepeat,0);
    parentTimeline.add(timelineToRepeat,3.67);
    parentTimeline.add(timelineToRepeat,6.17);
    

    Second approach trying to change repeatDelay on the fly.  This did not work-

    var repeatDelays = [2.67, 1.5, 2.58];
    var timelineToRepeat = new TimelineMax({repeat: -1, onRepeat: onRepeat})
    function onRepeat(){
        var delay = repeatDelays.shift();
        repeatDelays.push(delay);
        timelineToRepeat.repeatDelay(delay);
    }
    

    Any suggestions on a good way to do this kind of animation of Greensock?

     

    Thanks

     

     

     

     

×
×
  • Create New...