tameemsafi / typewriterjs

A simple yet powerful native javascript plugin for a cool typewriter effect.
https://www.npmjs.com/package/typewriter-effect
MIT License
2.49k stars 221 forks source link

deleteSpeed Not working as expected #172

Open Jules003 opened 1 year ago

Jules003 commented 1 year ago

hello there below is attached the typewriter component for my react app and the issue i am having is that the deleteSpeed prop is not working as expected. I tried integrating the changeDeleteSpeed() method however the same issue still persists. the delay prop works fine.

<Typewriter onInit={(typewriter) => { typewriter .typeString("sentence 1") .pauseFor(1500) .deleteAll() .typeString(" sentence 2") .pauseFor(3000) .deleteAll() .callFunction(() => { $("#scroll-wrapper").addClass("show-up"); props.addSections.addSections(true); }) .typeString("Scroll down to learn more :)") .pauseFor(1500) .deleteAll() .callFunction(() => { setIsReadyToUnmount(true); }) .start(); }} options={{ delay: 45, deleteSpeed: 10, }} />

ignacioportigliatti commented 1 year ago

Same issue here :(

ignacioportigliatti commented 1 year ago

hello there below is attached the typewriter component for my react app and the issue i am having is that the deleteSpeed prop is not working as expected. I tried integrating the changeDeleteSpeed() method however the same issue still persists. the delay prop works fine.

<Typewriter onInit={(typewriter) => { typewriter .typeString("sentence 1") .pauseFor(1500) .deleteAll() .typeString(" sentence 2") .pauseFor(3000) .deleteAll() .callFunction(() => { $("#scroll-wrapper").addClass("show-up"); props.addSections.addSections(true); }) .typeString("Scroll down to learn more :)") .pauseFor(1500) .deleteAll() .callFunction(() => { setIsReadyToUnmount(true); }) .start(); }} options={{ delay: 45, deleteSpeed: 10, }} />

I just found a way !

<Typewriter
        onInit={(typewriter) => {
            typewriter
                .pauseFor(3000)
                .typeString(`ExampleString`)
                .pauseFor(1000)
                .deleteAll(10)
                .typeString(`ExampleString`)
                .pauseFor(1000)
                .deleteAll(10)
                .start()
        }}
        options={{
          autoStart: true,
          loop: true,
          delay: 50,
        }}
 />

You have to manually put the speed of the deleting on the deleteAll() function. I managed it that way and is working so far.

.deleteAll(speed)

dbareis commented 1 year ago

It looks like the deleteSpeed is only applied for the .deleteChars() function.