| 12345678910111213141516171819202122232425262728293031323334353637 |
- import _extends from "@babel/runtime/helpers/esm/extends";
- const initMotionCommon = duration => ({
- animationDuration: duration,
- animationFillMode: 'both'
- });
- // FIXME: origin less code seems same as initMotionCommon. Maybe we can safe remove
- const initMotionCommonLeave = duration => ({
- animationDuration: duration,
- animationFillMode: 'both'
- });
- export const initMotion = function (motionCls, inKeyframes, outKeyframes, duration) {
- let sameLevel = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
- const sameLevelPrefix = sameLevel ? '&' : '';
- return {
- [`
- ${sameLevelPrefix}${motionCls}-enter,
- ${sameLevelPrefix}${motionCls}-appear
- `]: _extends(_extends({}, initMotionCommon(duration)), {
- animationPlayState: 'paused'
- }),
- [`${sameLevelPrefix}${motionCls}-leave`]: _extends(_extends({}, initMotionCommonLeave(duration)), {
- animationPlayState: 'paused'
- }),
- [`
- ${sameLevelPrefix}${motionCls}-enter${motionCls}-enter-active,
- ${sameLevelPrefix}${motionCls}-appear${motionCls}-appear-active
- `]: {
- animationName: inKeyframes,
- animationPlayState: 'running'
- },
- [`${sameLevelPrefix}${motionCls}-leave${motionCls}-leave-active`]: {
- animationName: outKeyframes,
- animationPlayState: 'running',
- pointerEvents: 'none'
- }
- };
- };
|