Change number with flipping animation
$ npm install --save number-flip
import Flip from 'number-flip'
new Flip({
node: $('.flip'),
from: 9527,
to: 42
})
new Flip({
node: $('.flip'),
from: 9527,
to: 42,
delay: 1 // second
})
const el = new Flip({
node: $('.flip'),
from: 9527
})
el.flipTo({to: 42})
new Flip({
node: document.querySelector('.flip'),
from: 9527,
to: 42,
duration: 2 // second
})
new Flip({
node: document.querySelector('.flip'),
from: 73,
to: 25,
duration: 2,
delay: 1,
easeFn: function(pos) {
if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,3);
return 0.5 * (Math.pow((pos-2),3) + 2);
}, // for more easing function, see https://github.com/danro/easing-js/blob/master/easing.js
systemArr: ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
})
- flip with FLIP
- syntax
- browser compatibility list
MIT
- fork this repo
git checkout -b NEW-FEATURE
git commit -am 'ADD SOME FEATURE'
git push origin NEW-FEATURE