Jump to content
GreenSock

pr1ntr

Draggable.onThrowUpdate stops other timelines?

Recommended Posts

I have a draggable instance that is responsive for page scrolling on tablet devices. 

When the onDrag events fire it runs a function that updates stuff on the page with its current position (0-1) and scrollTop/y  to a method that delegates this information to tell stuff to parallax or trigger if it has gotten far enough down the page. 

 

A problem is starting to present that when onDrag fires this update method everything parallaxes fine however when onThrowUpdate runs it stops this particular parallax animation.

 

I think it may have something to do with how the animations is run. Here is the code

 

 

tweenParallax = (pos,tween,min,max,dur) ->
    amount = ((pos / max) * 1) * dur
    
    
    if pos <= max and pos >= min
        tween.tweenTo amount , 
            overwrite:'all'
            ease:Quad.easeOut


module.exports.clouds = (setId, min, max, dur) ->

    minPos = min
    maxPos = max
    duration = dur
    
    $el = $(".clouds#{setId}")    
    clouds = $el.find(".cloud")
    
    tween = new TimelineMax
    
    tween.add TweenMax.to clouds , duration , 
        y:"+=400"
        
    tween.paused(true)
    
    
    
    
    return (pos) ->
        tweenParallax pos , tween , minPos, maxPos, duration
        
 
pardon my coffee. Let mek now if you need a codepen, it may take some time to set one up.
Link to comment
Share on other sites

turns out i needed a different overwrite

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.
×