Page animations by mouse and touch moves
npm install --save anm
var anm = require('anm');
anm('.element')
.x(15)
.y(-15)
.scale(10)
.opacity(50);
Create animation
anm('.element')
anm(document.querySelector('.element'))
Set transform factor
anm('.element').set('scale', 50);
or transform function
anm('.element').set('x', function(cursor) {
return cursor.x * 0.5;
});
All factors set in percent of max value. Positive values set direct motion, negative - inverse (excluding opacity).
Set opacity
anm('.element').opacity(50);
Set horizontal movement
anm('.element').x(-15);
Set vertical movement
anm('.element').y(-15);
Set rescaling
anm('.element').scale(75);
Set rotation
anm('.element').rotate(25);
Enable animations
Disable animations
Toggle enabled of animations
- Chrome
- Safari
- Firefox
- Opera
- IE 9+
MIT