-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One-direction tweens #141
Comments
Hi and thanks for your input. So far I haven't done it, because I wasn't really sure how I want to implement it. Your approach would enforce that, while also enabling users to add a separate scene, for the reverse animation. I really like it and I will think about it some more and then implement it in the next release. The question is though, if that makes the "reverse" option obsolete... regards, |
One thing though: in your solution you also ´.stop()´ the respective tween for the other scroll direction. Also it would raise the question of what is start and what is end for the scene. Would the duration for a "backward" scene be counted upwards? I guess it must be... |
|
3 Okay, I found the problem. In my case, when animation is scroll-independent, it's important to stop previous animation or to wait until it runs to the end. Otherwise both tweens will animate the same object properties of the same object and will fail. It means, that such animations should not animate the same properties of the same objects simultaneously if scene is scroll-dependent or previous animation should be stopped before current if scroll-independent using events and explicit tween variable declaration. Sounds bad. What about |
I'm just thinking about how this would affect pins... Unless of course we invert the duration logic for reverse scenes. Then there's the issue you mentioned, that there may be conflicting tweens. there's still tons of stuff to think about. Could you provide a real life example of where this feature is actually useful? Like your above code in a jsfiddle? |
Or what if we'll use two tweens in one scene somehow like that:
So we would be able to stop corresponding tweens when needed. But partially it breaks one-tween-one-scene rule. Partially means, that scene will contain two tweens, but in one moment would be active only one. |
Well that was my original thought when I wrote that TODO note. |
Yep. |
Here it is: http://jsfiddle.net/outring/9z49rLb9/5/ |
awesome, very good demo, thanks! |
Hi! |
Hi |
Yes, I know what you mean. |
Hi!
So much for my reasoning. Don't be disappointed though! There is a silver lining: Before, when a zero duration scene was triggered it viewed the end to be the same as the start. While this does make sense for scenes with duration (where the closing events would be at a later point in time and not at the same time) I figured this is kind of unexpected for zero duration scenes. So in the upcoming release zero duration scenes will be regarded as "open end" and the trigger events will be fired like this: This makes it both easier to attach actions to the respective event and also more intuitive as to when it is triggered. So as a special treat for you I prepared a solution for the multi direction conundrum using the alpha version of the upcoming release here: It is the best solution yet, because it will always bounce out, even if you scroll quickly forward and backward over the scene trigger. Plus due to the new event logic it's also quite intuitive to use. I hope this helps you. best regards, P.S.: In the future I plan to make a tutorial about this... |
I'm currently working on a site design that starts the visitor at the bottom and requires they scroll up. I forked the code and added a new option to I haven't yet tested how this works with pins since it's not in my use case, but I'd be willing to work on it and submit a pull request. The code to implement invert is very straight-forward and allows for this use case with very little effort and keeps it opt-in for the consumer. |
@janpaepke it looks great! Thank you! But the last thing: what do you think about |
@PizzaBrandon Thank you for your help and thanks a lot for the contribution offer! Furthermore: Apart from your (programmatically undoubtedly the most elegant) solution users can also achieve the same effect with the current version of ScrollMagic by either adding the tweens in reverse (tweening from 200 to 0 instead of 0 to 200) or by using the progress event and then updating the tween progress to That being said I think that scrolling from bottom to top is a VERY rare usecase at best and I decided NOT to add this feature to ScrollMagic, as it would cause more confusion and code bloating than it benefits users. @outring I see your point. I guess it does make sense to be able to reset positions when a scene is destroyed. Okay - I will add a |
Now it's very hard to create different tweens for different scroll directions (forward/backward). It could very useful, when you want to use, for example, different easings for different directions. Now there is two options:
Update tween of scene after scene finished or before it's start. To be honest, I had no success with that option, I had tried all events (enter, leave, start, end) with tween changes using TweenMax.updateTo and ScrollScene.setTween. It looks very complex, unfriendly and hacky.
Play forward/backward tweens manually on ScrollScene
enter
eventSecond one works great, but it doesn't respect ScrollScene.destroy(). It could be handled with
destroy
event, but it's not the perfect solution, I think. It doesn't mean, thatdestroy
event not needed, it's presence seems quite logical to me, according to demos, where some external work done inside event handlers.Perfect solution, I think, is to add
scrollDirection
option to scene, which works only with tweens and have three values:both
(default),forward
andbackward
.The text was updated successfully, but these errors were encountered: