typewriterjs
typewriterjs copied to clipboard
Delete Speed only working for second string
Hello, so i'm trying to write two strings and i'm having issues defining the delete speed of characters. Currently in the options I have set it to 2 like this:
const typeWriter = new Typewriter('.tagLine', { devMode: true, delay:40, loop: true, deleteSpeed: 2 });
And to activate the TypeWriter I have this:
typeWriter .pauseFor(1000) .typeString('Producers of video content, graphic identity, objects, sets and installations.') .pauseFor(3000) .deleteAll() .typeString('Producteurs de contenu vidéo, d\'identité graphique, d\'objets, de décors et d\'installations.') .pauseFor(3000) .start();
Issue is the "deleteSpeed: 2" is only taken into consideration with the second String and not the first one. I tried adding methods of changeDeleteSpeed but no luck. The first String seems to keep the "natural" delete speed whereas the second takes the speed I give him.
Hi there,
I was struggling with "kinda" the same problem and couldn't figure out why my deleteSpeed wasn't used by typewriter.
What actually helped me was passing a parameter to deleteAll(), e.g. deleteAll(2) (very fast deleting)
It's just a work around though, it might help you out, because with this way your deleteSpeed will def be taken into consideration. I think that somewhere in the internal implementation the customized deleteSpeed parameter is lost and therfor not passed to the delete method, which means the default speed is being used, as you already figured out.
/**
* Add delete all characters to event queue
*
* @return {Typewriter}
*
* @author Tameem Safi <[email protected]>
*/
deleteAll = (speed = 'natural') => {
this.addEventToQueue(EVENT_NAMES.REMOVE_ALL, { speed });
return this;
}
Just checking in to confirm deleteSpeed doesn't seem to work for me either, but passing a parameter to deleteAll works great.
However, I ran into a case where I want to just clear them with no animation. Passing 0 doesn't seem to work. How can I delete all instantly?