Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

typing animation in js

// typing animation in js:
//copy the following code:
const sleep = (milliseconds) => {
  return new Promise(resolve => setTimeout(resolve, milliseconds))
}

const applyTypingAnimation = async (element, delay) => {
  const stringToWrite= element.innerText;
  element.innerHTML= "";
  let refill= "";
  const cursorHTML= "▮";
  for (character of stringToWrite) {
    refill+= character;
    await sleep(delay)
    element.innerHTML= refill+cursorHTML;
  }
}

// calling the function:
applyTipingAnimation(/*your element*/, /*your delay*/)
Comment

animated typing js

<script src="https://unpkg.com/typewriter-effect@latest/dist/core.js"></script>
var app = document.getElementById('app');

        var typewriter = new Typewriter(app, {
            loop: true,
            delay: 75,
        });

        typewriter
            .pauseFor(500)
            .typeString('Websites')
            .pauseFor(500)
            .deleteChars(9)
            .pauseFor(500)
            .typeString('Messenger')
            .pauseFor(500)
            .deleteChars(9)
            .pauseFor(500)
            .typeString('Instagram')
            .pauseFor(500)
            .deleteChars(9)
            .pauseFor(500)
            .typeString('Whats App')
            .pauseFor(500)
            .deleteChars(9)
            .pauseFor(1000)
            .start();
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript Example 1: Regular Expressions 
Javascript :: npm ERR! code E405 npm ERR! 405 Method Not Allowed - GET https://registry.npmjs.org/ 
Javascript :: convert string to float javascript 
Javascript :: javascript while loop 
Javascript :: variables in js 
Javascript :: js sort strings lowercase and uppercase 
Javascript :: compare between two arrays javascript 
Javascript :: base64 to pdf in replace nodejs 
Javascript :: submit form react js 
Javascript :: javascript spread array without duplicates 
Javascript :: nodejs set dns for request 
Javascript :: replace js 
Javascript :: functions in javascript 
Javascript :: ckeditor config 
Javascript :: The missing value javascript 
Javascript :: get javascript parameter 
Javascript :: how to practice javascript 
Javascript :: let javascript 
Javascript :: react strict mode 
Javascript :: Unable to resolve "@react-native-community/masked-view" from 
Javascript :: how to get user info from google oauth node js 
Javascript :: reverse a string javascript 
Javascript :: axios set request header 
Javascript :: install json ubuntu 
Javascript :: adding a if stement in jsx 
Javascript :: how to insert a value into an array javascript 
Javascript :: what are closures 
Javascript :: array remove first element js 
Javascript :: nuxt 3 font awesome 
Javascript :: learn nodejs 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =