universal-transition
Version:
A universal transition API.
49 lines (42 loc) • 1.16 kB
JavaScript
;
exports.__esModule = true;
exports.default = transition;
var _process = require("../process");
var __read = void 0 && (void 0).__read || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o),
r,
ar = [],
e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
ar.push(r.value);
}
} catch (error) {
e = {
error: error
};
} finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
} finally {
if (e) throw e.error;
}
}
return ar;
};
function transition(node, styles, options, callback) {
var _a;
if (!node) return;
_a = __read((0, _process.processParams)(options, callback), 2), options = _a[0], callback = _a[1];
styles = (0, _process.processStyle)(styles);
var animation = weex.requireModule('animation');
animation.transition(node.ref, {
styles: styles,
timingFunction: options.timingFunction || 'ease',
delay: options.delay || 0,
duration: options.duration || 0,
needLayout: options.needLayout || false
}, callback || function () {});
}