animate-text

Installation method

  • Methods a
npm install animate-text --saveCopy the code

  • Way 2
Download dist/animate-text.min.js from your project and insert it into your project with the script tag, which can be accessed through window.animateTextCopy the code

<script type="text/javascript" src="dist/animate-text.min.js"></script>Copy the code





Parameters that

AnimateText accepts two arguments, for example: new AnimateText(Element, options)

parameter type If required describe
element String or Object is Can be a selector or a DOM node object (make sure this node contains only text and no other nodes)
options Number or Object no If the second parameter is a number, it is treated as the animation time. If there are other parameters, they are passed in object format. See options below for a description of each attribute


Instance object method description
//instantiation
var animateText = new AnimateText('.text')

//After the object is instantiated, the object provides the play method to replay the animation
//Accept parameters as animation time
//Without passing arguments, the instantiation time is used
animateText.play(1000)Copy the code