UNPKG

975 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _tinperBeeCore = require('tinper-bee-core');
8
9function animate(node, show, done) {
10 var height = void 0;
11 return (0, _tinperBeeCore.cssAnimation)(node, 'u-motion-collapse', {
12 start: function start() {
13 if (!show) {
14 node.style.height = node.offsetHeight + 'px';
15 } else {
16 height = node.offsetHeight;
17 node.style.height = 0;
18 }
19 },
20 active: function active() {
21 node.style.height = (show ? height : 0) + 'px';
22 },
23 end: function end() {
24 node.style.height = '';
25 done();
26 }
27 });
28}
29
30var animation = {
31 enter: function enter(node, done) {
32 return animate(node, true, done);
33 },
34 leave: function leave(node, done) {
35 return animate(node, false, done);
36 },
37 appear: function appear(node, done) {
38 return animate(node, true, done);
39 }
40};
41
42exports["default"] = animation;
43module.exports = exports['default'];
\No newline at end of file