Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

diaporama.next() skips transition #36

Closed
AVVS opened this issue Apr 14, 2015 · 10 comments
Closed

diaporama.next() skips transition #36

AVVS opened this issue Apr 14, 2015 · 10 comments

Comments

@AVVS
Copy link

AVVS commented Apr 14, 2015

I don't know if it's intended or not, but programatically switching the slide skips animation and instantly turns on the next slide. Is there any way to make sure transition animation is applied before next slide is turned on?

@gre
Copy link
Owner

gre commented Apr 14, 2015

The way it is currently designed and implemented makes it hard to make such jump transition possible.


The current implementation design is that the slideshow is statically defined in a timeline. The rendering of a frame at time currentTime should always give the exact same result. It is a bit like when you create a slideshow with a Movie Maker software.

To illustrate that, here is a screenshot (of diaporama-maker)

screen shot 2015-04-14 at 09 21 08

In that example, moving from second slide to third slide is implemented by setting the time to 10s that will skip the transition. Now I can't set the time to 8s to perform the transition because potentially the image have a kenburns effect on it so jumping to 8s will create a sudden image crop change.

Such implementation design make things lot more easier (for instance running the diaporama is just about setting the time value over time^^ – which also make it pretty easy to plug to virtual dom).


Now going back to your concern, I think you got a point that you expect the transition to occurs when leaving a slide programmatically, now I don't know yet how to address this problem (if you got an idea?) with my current implementation.
Maybe I should provide a lower level API where you have more control (to freely run images/transitions) – that might not be such hard to implement, but going that way will be harder to ensure consistency and easier to unlock other bugs.

tagging this issue difficulty:high but pretty important use-case.

@gre
Copy link
Owner

gre commented Apr 14, 2015

I have thought a bit more about the problem and it is a bit more clear on how I could address it.

I guess I could introduce this:
when you use .next() or prev() or any jump(slideIndex), you are like entering in a "black hole" time space that will perform the transition and once done will jump to 8s (like currently).
So in other words, currentTime is not the only time dimension, there would be another temporary timeline used when "catching up a time jump" (but you are always either in the timeline time or in the temporary timeline time).

I'm also thinking I could allow in the API to define your own transitionNext to use (to pass to .next()) for this transition. (because you might want a faster transition or no transition like current behavior).

@AVVS
Copy link
Author

AVVS commented Apr 15, 2015

For .prev() or .next() a plausible solution could be to simply speed up "time" - that way ken burns effect would still play our, but wont take as long as it normally would for my case

@gre
Copy link
Owner

gre commented Apr 15, 2015

that is likely to create weird sudden acceleration I think. but maybe I should give a try.

@AVVS
Copy link
Author

AVVS commented Apr 15, 2015

Easing might play nicely here, some ease-in + e^N acceleration function should be fine

@gre
Copy link
Owner

gre commented Apr 15, 2015

yeah that could work. and I guess it is not that hard to implement (the jump function would just set and track the playbackRate attribute to reach a given time – and you could give a requested duration in parameter to reach that time).

@gre
Copy link
Owner

gre commented Apr 15, 2015

Good news, I've implemented the "speed up" as you suggested.

There is a fresh 1.2.0 version that you can test.

Regards,
gre

@gre
Copy link
Owner

gre commented Apr 16, 2015

to summary:

I've released:

diaporama@1.2.0
diaporama-react@1.4.0

http://gre.gitbooks.io/diaporama/content/docs/api.html#methods

you can now optionally give a duration to next, prev, jump

@AVVS
Copy link
Author

AVVS commented Apr 16, 2015

I like it, much better than a simple jump. Great work!

@gre
Copy link
Owner

gre commented Apr 16, 2015

Thanks to you for the simple solution you end up with :-)
Le 16 avr. 2015 8:53 PM, "Vitaly Aminev" notifications@github.com a
écrit :

I like it, much better than a simple jump. Great work!

Reply to this email directly or view it on GitHub
#36 (comment).

@gre gre closed this as completed Apr 16, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants