SVG text animation effects based on jquery

Source: Internet
Author: User

This is a very creative segmented SVG text animation effect based on Segment.js. This text animation effects through the animated SVG stroke path to create a variety of text animation effect, the effect is very good
Very good SVG text animation effects


To use this SVG text animation effect, you introduce segment.js to the page, which is used to animate SVG paths, d3-ease, to make easing animation transitions, and letters.js.
<script src= "Js/segment.min.js" ></script>
<script src= "Js/d3-ease.v0.6.js" ></script>
<script src= "Js/letters.js" ></script>

HTML structure

You can use a <div> container to wrap text that you want to animate.

<div class= "Text" >Helloweba</div>

Set up and Invoke Plug-ins

We can then get this element in JavaScript and configure the parameters to animate the text. All parameter options (except Individualdelays) can be set to the following values:
Single value: Can be received by all letters.
Arrays: The first element in an array is received by the first letter, the second is received by the second letter, and so on.
Select element
var el = Document.queryselector ('. text ');

Each option can be defined as a single or can be defined as an array
var options = {
size:200,//font size, determines the height of the text, px
Weight:5,//bold, px
Rounded:false,//end of letter rounded corner
Color: [' #f90 ', ' #5F6062 '],//font colors
Duration:1,//per-letter animated display length (seconds)
Delay: [0, 0.1],//animation delay between each letter
fade:0.5,//Fade effect of duration (seconds)
Easing:d3_ease.easeCubicInOut.ease,//Buffering animation effects
Individualdelays:false//Default False, if set to false, the animation effect will be excessively displayed from left to right, if true, the letter animation effect is synchronized display
};

var myText = new Letters (el, options);

Mytext.show ();
With the above configuration, we have defined the options for text display and animation, and the plugin generates SVG text in the container. By default, text is hidden. Animate text is displayed by using Mytext.show (). Plug-ins also provide several other methods.
Text Hide
Mytext.hide ();

Toggle Text
Mytext.toggle ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.