Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Possible to cause index to change *before* animation? #120

Open
SteveEisner opened this issue Feb 12, 2014 · 2 comments
Open

Possible to cause index to change *before* animation? #120

SteveEisner opened this issue Feb 12, 2014 · 2 comments

Comments

@SteveEisner
Copy link

Hi, I'm using the carousel on mobile & love it. But there's one thing about the carousel index that makes it "feel" laggy even though it's not: the selected index doesn't change until the slide transition has completed. I'm using the carousel to activate nearby items based on the index, and those activations have their own animations, which means that after a quick swipe the user has to wait for both animations to complete (carousel to complete its swipe and then the stuff below it to fade in.)

Even without that double-animation pause, it feels funny that the indicator doesn't change until the animation is complete. Seems like it should "flip" to the next index once it's a sure thing that you're going to that slide (or at least at 50% of the way across.)

For now, would it be possible for you to expose a non-integer slide index? Maybe a bound scope variable could be maintained in the directive's scroll() function. (It'd be really helpful if it varied from 0..1 rather than returning the number of pixels.) Then I could do my own calculations - just round() the number to get my own selected index, etc.

This would also allow direct animations, where for instance I vary the opacity of one item downward and the next upward, proportionally to the scroll, effectively cross-fading between items even if the user holds on to the drag.

Thanks for considering it. I'd try to hack in a pull request but it'd take me a while to understand the ramifications in your code :(

@SteveEisner
Copy link
Author

re: my last comment, see the carousel here: http://vimeo.com/79659941 - these kinds of animations are possible if you have a non-int index (and a fast $digest loop!)

@revolunet
Copy link
Owner

maybe the new version could help you here. the animation part is separated in a service so you can fully control how single slides are rendered based on number of slides and current offset;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants