UNPKG

es6tween-plugin-typer

Version:

Text ticker/typer animation for crazy things

1 lines 1.27 kB
!function(t){"use strict";"function"==typeof define&&define.amd?define(["es6-tween"],t):"undefined"!=typeof module&&module.exports&&require("es6-tween")?module.exports=t(require("es6-tween")):"undefined"!=typeof exports&&exports.TWEEN?t(exports.TWEEN):"undefined"!=typeof window&&window.TWEEN?t(window.TWEEN):this.TWEEN&&t(this.TWEEN)}(function(t){"use strict";var e=/([<>:;])+/g,n=String("0~1!2@3#4$5%6^7&8*9(0)A-a_B=b+C[c{D]d}E;e:Gg|H/h?I,i<J.>j'K\"kLlMmNnOoPpQqRrSsTtUuVvWwYyXxZz"),i=t.Plugins,s=i.typer={};s.init=function(t,e,n){return this.et=e.text||e,this.typet=e&&void 0!==e.char?e.char:t&&void 0!==t.char?t.char:"_",this.useRandomChars=t&&void 0!==t.randomChars?t.randomChars:!e||void 0===e.randomChars||e.randomChars,this.st=t&&void 0!==t.text?t.text:"string"==typeof t?t:this.node.innerHTML,this},s.update=function(t,i,s,r,o,h){var d=this.st,o=this.et,a=this.typet,u=r<1&&r>0,f=this.useRandomChars&&u,p=Math.max(d.length,o.length),c=r*p,v=u?n.charAt(n.length*Math.random()|0):"";a=(0|c)%2&&u?a:"";var m=o.substr(0,c)+(f&&!e.test(v)?v:"")+a+d.substr(c,p);this.node.innerHTML=m};var r=i.number={};r.init=function(t,e,n){return this.snv=parseFloat(t),this.env=parseFloat(e)-this.snv,this},r.update=function(t,e,n,i,s,r){this.node.textContent=this.snv+this.env*i}});