You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
870 B

let velocity;
if (typeof document !== 'undefined' && typeof window !== 'undefined') {
velocity = require('velocity-animate');
}
9 years ago
function animate(node, show, transitionName, done) {
let ok;
function complete() {
if (!ok) {
ok = true;
done();
}
}
// Fix safari flash bug
/*eslint-disable */
9 years ago
node.style.display = show ? 'block' : 'none';
/*eslint-enable */
9 years ago
velocity(node, transitionName, {
duration: 240,
complete,
9 years ago
easing: 'easeInOutQuad'
});
return {
stop() {
velocity(node, 'finish');
complete();
}
};
}
const animation = {
enter(node, done) {
return animate(node, false, 'slideDown', done);
9 years ago
},
leave(node, done) {
return animate(node, true, 'slideUp', done);
9 years ago
},
appear(node, done) {
return animate(node, false, 'slideDown', done);
9 years ago
},
};
module.exports = animation;