22

Create a JavaScript Kinetic Typing Animation

 4 years ago
source link: https://www.tuicool.com/articles/qAzmmer
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
YzqQNbJ.png!webiue6buj.png!web

I write a post to inform you that I have added a typing effect to Scene.js Effects library.

https://github.com/daybrush/scenejs-effects

Typing animation refers to text that flows like typing in a typewriter.

In this article, I want to introduce the principles of typing animation.

Typing Animation

There are three typical ways to make typing animations.

  1. JavaScript Animation
  2. CSS Animation (PC Chrome Only)
  3. SVG Animation

The animation to be described in this article is JavaScript.

Because it’s simpler than I thought.

CSS animation can also create typing animations using the before or after pseudo selector and content property. However, since it is a selector that only supports PC Chrome, it is too much to use.

If your browser is PC Chrome, you will see the animation below.

M3UZfai.png!web

Typing animation is a method of importing text sequentially into html as shown below.

IJVFvuE.png!web

you create a typing animation using Scene.js , you can write the code as follows:

IJVFvuE.png!web

Play the above code and it will look like the following CodePen:

FviuUjv.png!web

Kinetic Animation

In addition to typing animation, it tries to have a kinetic effect.

The kinetic effect moves the origin point in the opposite direction.

The origin point appears to be fixed but is moving.

IJVFvuE.png!web

Once you create a kinetic animation using Scene.js, you can write the code as follows:

IJVFvuE.png!web

Play the above code and it will look like the following CodePen:

EJreeqa.png!web

Kinetic Typing Animation

Finally, add typing animation in time for kinetic effect.

IJVFvuE.png!web

Finally, if you tie the typing effect to the kinetic effect, it will be as follows:

Jvmy22M.jpg!web

Note:

To see more animation using Scene.js :

If you like it, press the star.

Feel free to contact me if you have any questions or requests by [email protected] or Twitter . See you soon!

Thank you


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK