Skip to content
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

theater.stop() to instantly stop a scene #50

Open
AmineI opened this issue Mar 10, 2016 · 4 comments
Open

theater.stop() to instantly stop a scene #50

AmineI opened this issue Mar 10, 2016 · 4 comments

Comments

@AmineI
Copy link

AmineI commented Mar 10, 2016

Hi again !
Actually, when you send theater.stop() , the JS wait until the sentence is finished before stopping.
A great enhancement could be to add a parameter to choose if the sentence must be finished or not :

I see a lot of uses for that feature, my try is to pause writing when the webpage isn't visible (= window minimized or user in another tab), and resume when it's visible so the user won't miss the text.
With the current theater.stop() it is impossible to correctly achieve, since the sentence finishes before stopping. You can see that concept here, try to switch tabs for more than 2 seconds :) https://jsfiddle.net/AmineIzumi/zy118txu/
Thanks in advance for your help ! 👍

@zhouzi
Copy link
Owner

zhouzi commented Mar 13, 2016

No problem, you're not bothering me at all, I'm always glad to get in touch with people using TheaterJS ;)

Back then, when I first added .stop(), I wanted it to stop the animation right away but I quickly figured out that it'd be really hard to achieve. The thing is, when an actor types, he can make mistakes but not too much. When he starts fixing his mistakes, he fixes them all at once. So it means that the animation has some states that depends on the previous calls. That's why a real stop feature is hard to implement. I can see some ways to handle that but it would involve rewriting a good part of TheaterJS to move the state management higher. It could be really interesting to have this feature and a lot of fun to code it but I can't promise anything about whether I'd do it and when.

Since I released the first version of TheaterJS, I've seen a lot of people using it by disabling the mistakes feature, setting a high and constant typing speed with just one actor. For such case, I think this library is an over-kill as implementing a typing/erasing animation in JavaScript is really easy. That's why I am currently writing a minimalist version with a lot of comments and the features that you are the most interested in. I'll make sure to add a stop function and let you know when I'm done (which should be in a few days) :)

@zhouzi
Copy link
Owner

zhouzi commented Mar 13, 2016

I finally had some time, so here is the "minimalist version". I've also added a note in the documentation. I'd be curious to know if it actually fits your needs?

@AmineI
Copy link
Author

AmineI commented Mar 13, 2016

Okay, thanks for your detailed explanation ! Your comments in the fiddle are also really useful !
This minimalist version is fitting my needs of stopping an animation instantly, but i don't think I'll replace TheaterJS by that one : Even if my fiddle had the mistakes feature disabled, it was only for example purpose, and this feature is what I mostly love in TheaterJS . It adds a 'human' touch to the typing animation, which i find really amazing :D !
However, this minimalist version is still really useful, and i'll probably use it someday for a 'static' text typing animation. Thank you again for that !

@zhouzi
Copy link
Owner

zhouzi commented Mar 13, 2016

Glad you like it, that's actually the whole purpose of TheaterJS :)

@zhouzi zhouzi changed the title theater.stop() , choose to instantly pause the sentence or wait until it's writed theater.stop() to instantly stop a scene Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants