UNPKG

@vimeo/iris

Version:
34 lines (29 loc) 921 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var tslib_es6 = require('../../tslib.es6-3ec409b7.js'); function domStyle(ref, style) { if (!ref.current) return; for (var key in style) ref.current.style[key] = style[key]; } function animate(ref, from, to) { var willChange = Object.keys(to).join(' '); requestAnimationFrame(function () { domStyle(ref, tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign({}, from), set), { willChange: willChange })); requestAnimationFrame(function () { domStyle(ref, tslib_es6.__assign(tslib_es6.__assign({}, to), unset)); }); }); } var set = { backfaceVisibility: 'hidden', transformStyle: 'preserve-3d', }; var unset = { backfaceVisibility: 'unset', willChange: 'unset', transformStyle: 'unset', }; exports.animate = animate; exports.domStyle = domStyle;