@remotion/transitions 4.0.56 → 4.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TransitionSeries.d.ts +4 -4
- package/dist/TransitionSeries.js +15 -23
- package/dist/cjs/TransitionSeries.d.ts +4 -4
- package/dist/cjs/fade.js +1 -1
- package/dist/cjs/flatten-children.d.ts +1 -1
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +50 -58
- package/dist/cjs/presentations/fade.d.ts +2 -3
- package/dist/cjs/presentations/flip.d.ts +2 -3
- package/dist/cjs/presentations/slide.d.ts +3 -4
- package/dist/cjs/presentations/wipe.d.ts +3 -4
- package/dist/cjs/slide.js +14 -14
- package/dist/cjs/timings/spring-timing.d.ts +2 -2
- package/dist/cjs/types.d.ts +2 -2
- package/dist/cjs/validate.d.ts +1 -1
- package/dist/cjs/wipe.js +26 -26
- package/dist/flatten-children.d.ts +1 -1
- package/dist/flatten-children.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/presentations/fade.d.ts +2 -3
- package/dist/presentations/fade.js +3 -3
- package/dist/presentations/flip.d.ts +2 -3
- package/dist/presentations/slide.d.ts +3 -4
- package/dist/presentations/slide.js +16 -16
- package/dist/presentations/wipe.d.ts +3 -4
- package/dist/presentations/wipe.js +28 -28
- package/dist/timings/spring-timing.d.ts +2 -2
- package/dist/timings/spring-timing.js +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/validate.d.ts +1 -1
- package/dist/validate.js +1 -1
- package/package.json +7 -6
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { FC, PropsWithChildren } from
|
|
2
|
-
import type { LayoutAndStyle, SequencePropsWithoutDuration } from
|
|
3
|
-
import type { TransitionSeriesTransitionProps } from
|
|
1
|
+
import type { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import type { LayoutAndStyle, SequencePropsWithoutDuration } from 'remotion';
|
|
3
|
+
import type { TransitionSeriesTransitionProps } from './types.js';
|
|
4
4
|
declare const TransitionSeriesTransition: <PresentationProps extends Record<string, unknown>>(_props: TransitionSeriesTransitionProps<PresentationProps>) => null;
|
|
5
5
|
type SeriesSequenceProps = PropsWithChildren<{
|
|
6
6
|
durationInFrames: number;
|
|
7
7
|
offset?: number;
|
|
8
8
|
className?: number;
|
|
9
|
-
} & LayoutAndStyle & Pick<SequencePropsWithoutDuration,
|
|
9
|
+
} & LayoutAndStyle & Pick<SequencePropsWithoutDuration, 'name'>>;
|
|
10
10
|
declare const SeriesSequence: ({ children }: SeriesSequenceProps) => JSX.Element;
|
|
11
11
|
declare const TransitionSeries: FC<SequencePropsWithoutDuration> & {
|
|
12
12
|
Sequence: typeof SeriesSequence;
|
package/dist/TransitionSeries.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Children, useMemo } from
|
|
3
|
-
import { Sequence, useCurrentFrame, useVideoConfig } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { validateDurationInFrames } from
|
|
2
|
+
import { Children, useMemo } from 'react';
|
|
3
|
+
import { Sequence, useCurrentFrame, useVideoConfig } from 'remotion';
|
|
4
|
+
import { flattenChildren } from './flatten-children.js';
|
|
5
|
+
import { slide } from './presentations/slide.js';
|
|
6
|
+
import { validateDurationInFrames } from './validate.js';
|
|
7
7
|
// eslint-disable-next-line react/function-component-definition
|
|
8
8
|
const TransitionSeriesTransition = function (
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -24,26 +24,26 @@ const TransitionSeriesChildren = ({ children, }) => {
|
|
|
24
24
|
return Children.map(flattedChildren, (child, i) => {
|
|
25
25
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
26
26
|
const current = child;
|
|
27
|
-
if (typeof current ===
|
|
27
|
+
if (typeof current === 'string') {
|
|
28
28
|
// Don't throw if it's just some accidential whitespace
|
|
29
|
-
if (current.trim() ===
|
|
29
|
+
if (current.trim() === '') {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
throw new TypeError(`The <TransitionSeries /> component only accepts a list of <TransitionSeries.Sequence /> components as its children, but you passed a string "${current}"`);
|
|
33
33
|
}
|
|
34
34
|
const hasPrev = flattedChildren[i - 1];
|
|
35
35
|
const nextPrev = flattedChildren[i + 1];
|
|
36
|
-
const prev = typeof hasPrev ===
|
|
36
|
+
const prev = typeof hasPrev === 'string' || typeof hasPrev === 'undefined'
|
|
37
37
|
? null
|
|
38
38
|
: hasPrev.type === TransitionSeriesTransition
|
|
39
39
|
? hasPrev
|
|
40
40
|
: null;
|
|
41
|
-
const next = typeof nextPrev ===
|
|
41
|
+
const next = typeof nextPrev === 'string' || typeof nextPrev === 'undefined'
|
|
42
42
|
? null
|
|
43
43
|
: nextPrev.type === TransitionSeriesTransition
|
|
44
44
|
? nextPrev
|
|
45
45
|
: null;
|
|
46
|
-
const prevIsTransition = typeof hasPrev ===
|
|
46
|
+
const prevIsTransition = typeof hasPrev === 'string' || typeof hasPrev === 'undefined'
|
|
47
47
|
? false
|
|
48
48
|
: hasPrev.type === TransitionSeriesTransition;
|
|
49
49
|
if (current.type === TransitionSeriesTransition) {
|
|
@@ -91,7 +91,6 @@ const TransitionSeriesChildren = ({ children, }) => {
|
|
|
91
91
|
startFrame -= actualStartFrame;
|
|
92
92
|
actualStartFrame = 0;
|
|
93
93
|
}
|
|
94
|
-
const inner = (_jsx(Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: child }));
|
|
95
94
|
const nextProgress = next
|
|
96
95
|
? next.props.timing.getProgress({
|
|
97
96
|
frame: frame -
|
|
@@ -120,25 +119,19 @@ const TransitionSeriesChildren = ({ children, }) => {
|
|
|
120
119
|
const prevPresentation = (_c = prev.props.presentation) !== null && _c !== void 0 ? _c : slide();
|
|
121
120
|
const UppercaseNextPresentation = nextPresentation.component;
|
|
122
121
|
const UppercasePrevPresentation = prevPresentation.component;
|
|
123
|
-
return (
|
|
124
|
-
// @ts-expect-error
|
|
125
|
-
_jsx(UppercaseNextPresentation, { passedProps: (_d = nextPresentation.props) !== null && _d !== void 0 ? _d : {}, presentationDirection: "exiting", presentationProgress: nextProgress, children: _jsx(UppercasePrevPresentation, { passedProps: (_e = prevPresentation.props) !== null && _e !== void 0 ? _e : {}, presentationDirection: "entering", presentationProgress: prevProgress, children: inner }) }));
|
|
122
|
+
return (_jsx(Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: _jsx(UppercaseNextPresentation, { passedProps: (_d = nextPresentation.props) !== null && _d !== void 0 ? _d : {}, presentationDirection: "exiting", presentationProgress: nextProgress, children: _jsx(UppercasePrevPresentation, { passedProps: (_e = prevPresentation.props) !== null && _e !== void 0 ? _e : {}, presentationDirection: "entering", presentationProgress: prevProgress, children: child }) }) }));
|
|
126
123
|
}
|
|
127
124
|
if (prevProgress !== null && prev) {
|
|
128
125
|
const prevPresentation = (_f = prev.props.presentation) !== null && _f !== void 0 ? _f : slide();
|
|
129
126
|
const UppercasePrevPresentation = prevPresentation.component;
|
|
130
|
-
return (
|
|
131
|
-
// @ts-expect-error
|
|
132
|
-
_jsx(UppercasePrevPresentation, { passedProps: (_g = prevPresentation.props) !== null && _g !== void 0 ? _g : {}, presentationDirection: "entering", presentationProgress: prevProgress, children: inner }));
|
|
127
|
+
return (_jsx(Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: _jsx(UppercasePrevPresentation, { passedProps: (_g = prevPresentation.props) !== null && _g !== void 0 ? _g : {}, presentationDirection: "entering", presentationProgress: prevProgress, children: child }) }));
|
|
133
128
|
}
|
|
134
129
|
if (nextProgress !== null && next) {
|
|
135
130
|
const nextPresentation = (_h = next.props.presentation) !== null && _h !== void 0 ? _h : slide();
|
|
136
131
|
const UppercaseNextPresentation = nextPresentation.component;
|
|
137
|
-
return (
|
|
138
|
-
// @ts-expect-error
|
|
139
|
-
_jsx(UppercaseNextPresentation, { passedProps: (_j = nextPresentation.props) !== null && _j !== void 0 ? _j : {}, presentationDirection: "exiting", presentationProgress: nextProgress, children: inner }));
|
|
132
|
+
return (_jsx(Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: _jsx(UppercaseNextPresentation, { passedProps: (_j = nextPresentation.props) !== null && _j !== void 0 ? _j : {}, presentationDirection: "exiting", presentationProgress: nextProgress, children: child }) }));
|
|
140
133
|
}
|
|
141
|
-
return
|
|
134
|
+
return (_jsx(Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: child }));
|
|
142
135
|
});
|
|
143
136
|
}, [children, fps, frame]);
|
|
144
137
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
@@ -146,8 +139,7 @@ const TransitionSeriesChildren = ({ children, }) => {
|
|
|
146
139
|
};
|
|
147
140
|
const TransitionSeries = ({ children, ...otherProps }) => {
|
|
148
141
|
var _a;
|
|
149
|
-
const
|
|
150
|
-
const showInTimeline = frame < ((_a = otherProps.from) !== null && _a !== void 0 ? _a : 0);
|
|
142
|
+
const showInTimeline = ((_a = otherProps.from) !== null && _a !== void 0 ? _a : 0) !== 0;
|
|
151
143
|
return (_jsx(Sequence, { showInTimeline: showInTimeline, ...otherProps, children: _jsx(TransitionSeriesChildren, { children: children }) }));
|
|
152
144
|
};
|
|
153
145
|
TransitionSeries.Sequence = SeriesSequence;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { FC, PropsWithChildren } from
|
|
2
|
-
import type { LayoutAndStyle, SequencePropsWithoutDuration } from
|
|
3
|
-
import type { TransitionSeriesTransitionProps } from
|
|
1
|
+
import type { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import type { LayoutAndStyle, SequencePropsWithoutDuration } from 'remotion';
|
|
3
|
+
import type { TransitionSeriesTransitionProps } from './types.js';
|
|
4
4
|
declare const TransitionSeriesTransition: <PresentationProps extends Record<string, unknown>>(_props: TransitionSeriesTransitionProps<PresentationProps>) => null;
|
|
5
5
|
type SeriesSequenceProps = PropsWithChildren<{
|
|
6
6
|
durationInFrames: number;
|
|
7
7
|
offset?: number;
|
|
8
8
|
className?: number;
|
|
9
|
-
} & LayoutAndStyle & Pick<SequencePropsWithoutDuration,
|
|
9
|
+
} & LayoutAndStyle & Pick<SequencePropsWithoutDuration, 'name'>>;
|
|
10
10
|
declare const SeriesSequence: ({ children }: SeriesSequenceProps) => JSX.Element;
|
|
11
11
|
declare const TransitionSeries: FC<SequencePropsWithoutDuration> & {
|
|
12
12
|
Sequence: typeof SeriesSequence;
|
package/dist/cjs/fade.js
CHANGED
|
@@ -9,7 +9,7 @@ var remotion = require('remotion');
|
|
|
9
9
|
const FadePresentation = ({ children, presentationDirection, presentationProgress }) => {
|
|
10
10
|
const style = react.useMemo(() => {
|
|
11
11
|
return {
|
|
12
|
-
opacity: presentationDirection ===
|
|
12
|
+
opacity: presentationDirection === 'entering' ? presentationProgress : 1,
|
|
13
13
|
};
|
|
14
14
|
}, [presentationDirection, presentationProgress]);
|
|
15
15
|
return (jsxRuntime.jsx(remotion.AbsoluteFill, { children: jsxRuntime.jsx(remotion.AbsoluteFill, { style: style, children: children }) }));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export declare const flattenChildren: (children: React.ReactNode) => (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal)[];
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
export { linearTiming } from './timings/linear-timing.js';
|
|
1
2
|
export { springTiming } from './timings/spring-timing.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { TransitionTiming, TransitionPresentation, TransitionPresentationComponentProps, } from "./types.js";
|
|
3
|
+
export { TransitionSeries } from './TransitionSeries.js';
|
|
4
|
+
export { TransitionPresentation, TransitionPresentationComponentProps, TransitionTiming, } from './types.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -10,9 +10,24 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
12
|
|
|
13
|
+
const linearTiming = (options) => {
|
|
14
|
+
return {
|
|
15
|
+
getDurationInFrames: () => {
|
|
16
|
+
return options.durationInFrames;
|
|
17
|
+
},
|
|
18
|
+
getProgress: ({ frame }) => {
|
|
19
|
+
return remotion.interpolate(frame, [0, options.durationInFrames], [0, 1], {
|
|
20
|
+
easing: options.easing,
|
|
21
|
+
extrapolateLeft: 'clamp',
|
|
22
|
+
extrapolateRight: 'clamp',
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
13
28
|
const springWithInvalidArgumentRejection = (args) => {
|
|
14
29
|
if (args.to || args.from) {
|
|
15
|
-
throw new Error(
|
|
30
|
+
throw new Error('to / from values are not supported by springWithRoundUpIfThreshold');
|
|
16
31
|
}
|
|
17
32
|
return remotion.spring(args);
|
|
18
33
|
};
|
|
@@ -40,38 +55,35 @@ const springTiming = (options = {}) => {
|
|
|
40
55
|
};
|
|
41
56
|
};
|
|
42
57
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
};
|
|
58
|
+
const flattenChildren = (children) => {
|
|
59
|
+
const childrenArray = React__default["default"].Children.toArray(children);
|
|
60
|
+
return childrenArray.reduce((flatChildren, child) => {
|
|
61
|
+
if (child.type === React__default["default"].Fragment) {
|
|
62
|
+
return flatChildren.concat(flattenChildren(child.props
|
|
63
|
+
.children));
|
|
64
|
+
}
|
|
65
|
+
flatChildren.push(child);
|
|
66
|
+
return flatChildren;
|
|
67
|
+
}, []);
|
|
56
68
|
};
|
|
57
69
|
|
|
58
|
-
const SlidePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction =
|
|
70
|
+
const SlidePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = 'from-left' }, }) => {
|
|
59
71
|
const directionStyle = React.useMemo(() => {
|
|
60
|
-
if (presentationDirection ===
|
|
72
|
+
if (presentationDirection === 'exiting') {
|
|
61
73
|
switch (direction) {
|
|
62
|
-
case
|
|
74
|
+
case 'from-left':
|
|
63
75
|
return {
|
|
64
76
|
transform: `translateX(${presentationProgress * 100}%)`,
|
|
65
77
|
};
|
|
66
|
-
case
|
|
78
|
+
case 'from-right':
|
|
67
79
|
return {
|
|
68
80
|
transform: `translateX(-${presentationProgress * 100}%)`,
|
|
69
81
|
};
|
|
70
|
-
case
|
|
82
|
+
case 'from-top':
|
|
71
83
|
return {
|
|
72
84
|
transform: `translateY(${presentationProgress * 100}%)`,
|
|
73
85
|
};
|
|
74
|
-
case
|
|
86
|
+
case 'from-bottom':
|
|
75
87
|
return {
|
|
76
88
|
transform: `translateY(-${presentationProgress * 100}%)`,
|
|
77
89
|
};
|
|
@@ -80,19 +92,19 @@ const SlidePresentation = ({ children, presentationProgress, presentationDirecti
|
|
|
80
92
|
}
|
|
81
93
|
}
|
|
82
94
|
switch (direction) {
|
|
83
|
-
case
|
|
95
|
+
case 'from-left':
|
|
84
96
|
return {
|
|
85
97
|
transform: `translateX(${-100 + presentationProgress * 100}%)`,
|
|
86
98
|
};
|
|
87
|
-
case
|
|
99
|
+
case 'from-right':
|
|
88
100
|
return {
|
|
89
101
|
transform: `translateX(${100 - presentationProgress * 100}%)`,
|
|
90
102
|
};
|
|
91
|
-
case
|
|
103
|
+
case 'from-top':
|
|
92
104
|
return {
|
|
93
105
|
transform: `translateY(${-100 + presentationProgress * 100}%)`,
|
|
94
106
|
};
|
|
95
|
-
case
|
|
107
|
+
case 'from-bottom':
|
|
96
108
|
return {
|
|
97
109
|
transform: `translateY(${100 - presentationProgress * 100}%)`,
|
|
98
110
|
};
|
|
@@ -102,10 +114,10 @@ const SlidePresentation = ({ children, presentationProgress, presentationDirecti
|
|
|
102
114
|
}, [presentationDirection, presentationProgress, direction]);
|
|
103
115
|
const style = React.useMemo(() => {
|
|
104
116
|
return {
|
|
105
|
-
width:
|
|
106
|
-
height:
|
|
107
|
-
justifyContent:
|
|
108
|
-
alignItems:
|
|
117
|
+
width: '100%',
|
|
118
|
+
height: '100%',
|
|
119
|
+
justifyContent: 'center',
|
|
120
|
+
alignItems: 'center',
|
|
109
121
|
...directionStyle,
|
|
110
122
|
};
|
|
111
123
|
}, [directionStyle]);
|
|
@@ -118,18 +130,6 @@ const slide = (props) => {
|
|
|
118
130
|
};
|
|
119
131
|
};
|
|
120
132
|
|
|
121
|
-
const flattenChildren = (children) => {
|
|
122
|
-
const childrenArray = React__default["default"].Children.toArray(children);
|
|
123
|
-
return childrenArray.reduce((flatChildren, child) => {
|
|
124
|
-
if (child.type === React__default["default"].Fragment) {
|
|
125
|
-
return flatChildren.concat(flattenChildren(child.props
|
|
126
|
-
.children));
|
|
127
|
-
}
|
|
128
|
-
flatChildren.push(child);
|
|
129
|
-
return flatChildren;
|
|
130
|
-
}, []);
|
|
131
|
-
};
|
|
132
|
-
|
|
133
133
|
/* eslint-disable prefer-destructuring */
|
|
134
134
|
const validateDurationInFrames = remotion.Internals.validateDurationInFrames;
|
|
135
135
|
|
|
@@ -153,26 +153,26 @@ const TransitionSeriesChildren = ({ children, }) => {
|
|
|
153
153
|
return React.Children.map(flattedChildren, (child, i) => {
|
|
154
154
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
155
155
|
const current = child;
|
|
156
|
-
if (typeof current ===
|
|
156
|
+
if (typeof current === 'string') {
|
|
157
157
|
// Don't throw if it's just some accidential whitespace
|
|
158
|
-
if (current.trim() ===
|
|
158
|
+
if (current.trim() === '') {
|
|
159
159
|
return null;
|
|
160
160
|
}
|
|
161
161
|
throw new TypeError(`The <TransitionSeries /> component only accepts a list of <TransitionSeries.Sequence /> components as its children, but you passed a string "${current}"`);
|
|
162
162
|
}
|
|
163
163
|
const hasPrev = flattedChildren[i - 1];
|
|
164
164
|
const nextPrev = flattedChildren[i + 1];
|
|
165
|
-
const prev = typeof hasPrev ===
|
|
165
|
+
const prev = typeof hasPrev === 'string' || typeof hasPrev === 'undefined'
|
|
166
166
|
? null
|
|
167
167
|
: hasPrev.type === TransitionSeriesTransition
|
|
168
168
|
? hasPrev
|
|
169
169
|
: null;
|
|
170
|
-
const next = typeof nextPrev ===
|
|
170
|
+
const next = typeof nextPrev === 'string' || typeof nextPrev === 'undefined'
|
|
171
171
|
? null
|
|
172
172
|
: nextPrev.type === TransitionSeriesTransition
|
|
173
173
|
? nextPrev
|
|
174
174
|
: null;
|
|
175
|
-
const prevIsTransition = typeof hasPrev ===
|
|
175
|
+
const prevIsTransition = typeof hasPrev === 'string' || typeof hasPrev === 'undefined'
|
|
176
176
|
? false
|
|
177
177
|
: hasPrev.type === TransitionSeriesTransition;
|
|
178
178
|
if (current.type === TransitionSeriesTransition) {
|
|
@@ -220,7 +220,6 @@ const TransitionSeriesChildren = ({ children, }) => {
|
|
|
220
220
|
startFrame -= actualStartFrame;
|
|
221
221
|
actualStartFrame = 0;
|
|
222
222
|
}
|
|
223
|
-
const inner = (jsxRuntime.jsx(remotion.Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: child }));
|
|
224
223
|
const nextProgress = next
|
|
225
224
|
? next.props.timing.getProgress({
|
|
226
225
|
frame: frame -
|
|
@@ -249,25 +248,19 @@ const TransitionSeriesChildren = ({ children, }) => {
|
|
|
249
248
|
const prevPresentation = (_c = prev.props.presentation) !== null && _c !== void 0 ? _c : slide();
|
|
250
249
|
const UppercaseNextPresentation = nextPresentation.component;
|
|
251
250
|
const UppercasePrevPresentation = prevPresentation.component;
|
|
252
|
-
return (
|
|
253
|
-
// @ts-expect-error
|
|
254
|
-
jsxRuntime.jsx(UppercaseNextPresentation, { passedProps: (_d = nextPresentation.props) !== null && _d !== void 0 ? _d : {}, presentationDirection: "exiting", presentationProgress: nextProgress, children: jsxRuntime.jsx(UppercasePrevPresentation, { passedProps: (_e = prevPresentation.props) !== null && _e !== void 0 ? _e : {}, presentationDirection: "entering", presentationProgress: prevProgress, children: inner }) }));
|
|
251
|
+
return (jsxRuntime.jsx(remotion.Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: jsxRuntime.jsx(UppercaseNextPresentation, { passedProps: (_d = nextPresentation.props) !== null && _d !== void 0 ? _d : {}, presentationDirection: "exiting", presentationProgress: nextProgress, children: jsxRuntime.jsx(UppercasePrevPresentation, { passedProps: (_e = prevPresentation.props) !== null && _e !== void 0 ? _e : {}, presentationDirection: "entering", presentationProgress: prevProgress, children: child }) }) }));
|
|
255
252
|
}
|
|
256
253
|
if (prevProgress !== null && prev) {
|
|
257
254
|
const prevPresentation = (_f = prev.props.presentation) !== null && _f !== void 0 ? _f : slide();
|
|
258
255
|
const UppercasePrevPresentation = prevPresentation.component;
|
|
259
|
-
return (
|
|
260
|
-
// @ts-expect-error
|
|
261
|
-
jsxRuntime.jsx(UppercasePrevPresentation, { passedProps: (_g = prevPresentation.props) !== null && _g !== void 0 ? _g : {}, presentationDirection: "entering", presentationProgress: prevProgress, children: inner }));
|
|
256
|
+
return (jsxRuntime.jsx(remotion.Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: jsxRuntime.jsx(UppercasePrevPresentation, { passedProps: (_g = prevPresentation.props) !== null && _g !== void 0 ? _g : {}, presentationDirection: "entering", presentationProgress: prevProgress, children: child }) }));
|
|
262
257
|
}
|
|
263
258
|
if (nextProgress !== null && next) {
|
|
264
259
|
const nextPresentation = (_h = next.props.presentation) !== null && _h !== void 0 ? _h : slide();
|
|
265
260
|
const UppercaseNextPresentation = nextPresentation.component;
|
|
266
|
-
return (
|
|
267
|
-
// @ts-expect-error
|
|
268
|
-
jsxRuntime.jsx(UppercaseNextPresentation, { passedProps: (_j = nextPresentation.props) !== null && _j !== void 0 ? _j : {}, presentationDirection: "exiting", presentationProgress: nextProgress, children: inner }));
|
|
261
|
+
return (jsxRuntime.jsx(remotion.Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: jsxRuntime.jsx(UppercaseNextPresentation, { passedProps: (_j = nextPresentation.props) !== null && _j !== void 0 ? _j : {}, presentationDirection: "exiting", presentationProgress: nextProgress, children: child }) }));
|
|
269
262
|
}
|
|
270
|
-
return
|
|
263
|
+
return (jsxRuntime.jsx(remotion.Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: child }));
|
|
271
264
|
});
|
|
272
265
|
}, [children, fps, frame]);
|
|
273
266
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
@@ -275,8 +268,7 @@ const TransitionSeriesChildren = ({ children, }) => {
|
|
|
275
268
|
};
|
|
276
269
|
const TransitionSeries = ({ children, ...otherProps }) => {
|
|
277
270
|
var _a;
|
|
278
|
-
const
|
|
279
|
-
const showInTimeline = frame < ((_a = otherProps.from) !== null && _a !== void 0 ? _a : 0);
|
|
271
|
+
const showInTimeline = ((_a = otherProps.from) !== null && _a !== void 0 ? _a : 0) !== 0;
|
|
280
272
|
return (jsxRuntime.jsx(remotion.Sequence, { showInTimeline: showInTimeline, ...otherProps, children: jsxRuntime.jsx(TransitionSeriesChildren, { children: children }) }));
|
|
281
273
|
};
|
|
282
274
|
TransitionSeries.Sequence = SeriesSequence;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { TransitionPresentation } from
|
|
2
|
-
type FadeProps = Record<string, never>;
|
|
1
|
+
import type { TransitionPresentation } from '../types.js';
|
|
2
|
+
export type FadeProps = Record<string, never>;
|
|
3
3
|
export declare const fade: (props?: FadeProps) => TransitionPresentation<FadeProps>;
|
|
4
|
-
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { TransitionPresentation } from '../types.js';
|
|
2
2
|
export type FlipDirection = 'from-left' | 'from-right' | 'from-top' | 'from-bottom';
|
|
3
|
-
type
|
|
3
|
+
export type FlipProps = {
|
|
4
4
|
direction?: FlipDirection;
|
|
5
5
|
perspective?: number;
|
|
6
6
|
};
|
|
7
|
-
export declare const flip: (props?:
|
|
8
|
-
export {};
|
|
7
|
+
export declare const flip: (props?: FlipProps) => TransitionPresentation<FlipProps>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { TransitionPresentation } from
|
|
2
|
-
export type SlideDirection =
|
|
3
|
-
type SlideProps = {
|
|
1
|
+
import type { TransitionPresentation } from '../types.js';
|
|
2
|
+
export type SlideDirection = 'from-left' | 'from-top' | 'from-right' | 'from-bottom';
|
|
3
|
+
export type SlideProps = {
|
|
4
4
|
direction?: SlideDirection;
|
|
5
5
|
};
|
|
6
6
|
export declare const slide: (props?: SlideProps) => TransitionPresentation<SlideProps>;
|
|
7
|
-
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { TransitionPresentation } from
|
|
2
|
-
export type WipeDirection =
|
|
3
|
-
type WipeProps = {
|
|
1
|
+
import type { TransitionPresentation } from '../types.js';
|
|
2
|
+
export type WipeDirection = 'from-left' | 'from-top-left' | 'from-top' | 'from-top-right' | 'from-right' | 'from-bottom-right' | 'from-bottom' | 'from-bottom-left';
|
|
3
|
+
export type WipeProps = {
|
|
4
4
|
direction?: WipeDirection;
|
|
5
5
|
};
|
|
6
6
|
export declare const wipe: (props?: WipeProps) => TransitionPresentation<WipeProps>;
|
|
7
|
-
export {};
|
package/dist/cjs/slide.js
CHANGED
|
@@ -6,23 +6,23 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var remotion = require('remotion');
|
|
8
8
|
|
|
9
|
-
const SlidePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction =
|
|
9
|
+
const SlidePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = 'from-left' }, }) => {
|
|
10
10
|
const directionStyle = react.useMemo(() => {
|
|
11
|
-
if (presentationDirection ===
|
|
11
|
+
if (presentationDirection === 'exiting') {
|
|
12
12
|
switch (direction) {
|
|
13
|
-
case
|
|
13
|
+
case 'from-left':
|
|
14
14
|
return {
|
|
15
15
|
transform: `translateX(${presentationProgress * 100}%)`,
|
|
16
16
|
};
|
|
17
|
-
case
|
|
17
|
+
case 'from-right':
|
|
18
18
|
return {
|
|
19
19
|
transform: `translateX(-${presentationProgress * 100}%)`,
|
|
20
20
|
};
|
|
21
|
-
case
|
|
21
|
+
case 'from-top':
|
|
22
22
|
return {
|
|
23
23
|
transform: `translateY(${presentationProgress * 100}%)`,
|
|
24
24
|
};
|
|
25
|
-
case
|
|
25
|
+
case 'from-bottom':
|
|
26
26
|
return {
|
|
27
27
|
transform: `translateY(-${presentationProgress * 100}%)`,
|
|
28
28
|
};
|
|
@@ -31,19 +31,19 @@ const SlidePresentation = ({ children, presentationProgress, presentationDirecti
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
switch (direction) {
|
|
34
|
-
case
|
|
34
|
+
case 'from-left':
|
|
35
35
|
return {
|
|
36
36
|
transform: `translateX(${-100 + presentationProgress * 100}%)`,
|
|
37
37
|
};
|
|
38
|
-
case
|
|
38
|
+
case 'from-right':
|
|
39
39
|
return {
|
|
40
40
|
transform: `translateX(${100 - presentationProgress * 100}%)`,
|
|
41
41
|
};
|
|
42
|
-
case
|
|
42
|
+
case 'from-top':
|
|
43
43
|
return {
|
|
44
44
|
transform: `translateY(${-100 + presentationProgress * 100}%)`,
|
|
45
45
|
};
|
|
46
|
-
case
|
|
46
|
+
case 'from-bottom':
|
|
47
47
|
return {
|
|
48
48
|
transform: `translateY(${100 - presentationProgress * 100}%)`,
|
|
49
49
|
};
|
|
@@ -53,10 +53,10 @@ const SlidePresentation = ({ children, presentationProgress, presentationDirecti
|
|
|
53
53
|
}, [presentationDirection, presentationProgress, direction]);
|
|
54
54
|
const style = react.useMemo(() => {
|
|
55
55
|
return {
|
|
56
|
-
width:
|
|
57
|
-
height:
|
|
58
|
-
justifyContent:
|
|
59
|
-
alignItems:
|
|
56
|
+
width: '100%',
|
|
57
|
+
height: '100%',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
alignItems: 'center',
|
|
60
60
|
...directionStyle,
|
|
61
61
|
};
|
|
62
62
|
}, [directionStyle]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SpringConfig } from
|
|
2
|
-
import type { TransitionTiming } from
|
|
1
|
+
import type { SpringConfig } from 'remotion';
|
|
2
|
+
import type { TransitionTiming } from '../types.js';
|
|
3
3
|
export declare const springTiming: (options?: {
|
|
4
4
|
config?: Partial<SpringConfig>;
|
|
5
5
|
durationInFrames?: number;
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentType } from
|
|
2
|
-
export type PresentationDirection =
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
export type PresentationDirection = 'entering' | 'exiting';
|
|
3
3
|
export type TransitionTiming = {
|
|
4
4
|
getDurationInFrames: (options: {
|
|
5
5
|
fps: number;
|
package/dist/cjs/validate.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Internals } from
|
|
1
|
+
import { Internals } from 'remotion';
|
|
2
2
|
export declare const validateDurationInFrames: typeof Internals.validateDurationInFrames;
|
package/dist/cjs/wipe.js
CHANGED
|
@@ -8,53 +8,53 @@ var remotion = require('remotion');
|
|
|
8
8
|
|
|
9
9
|
const makePathIn = (progress, direction) => {
|
|
10
10
|
switch (direction) {
|
|
11
|
-
case
|
|
11
|
+
case 'from-left':
|
|
12
12
|
return `
|
|
13
13
|
M 0 0
|
|
14
14
|
L ${progress} 0
|
|
15
15
|
L ${progress} 1
|
|
16
16
|
L 0 1
|
|
17
17
|
Z`;
|
|
18
|
-
case
|
|
18
|
+
case 'from-top-left':
|
|
19
19
|
return `
|
|
20
20
|
M 0 0
|
|
21
21
|
L ${progress * 2} 0
|
|
22
22
|
L 0 ${progress * 2}
|
|
23
23
|
Z`;
|
|
24
|
-
case
|
|
24
|
+
case 'from-top':
|
|
25
25
|
return `
|
|
26
26
|
M 0 0
|
|
27
27
|
L 1 0
|
|
28
28
|
L 1 ${progress}
|
|
29
29
|
L 0 ${progress}
|
|
30
30
|
Z`;
|
|
31
|
-
case
|
|
31
|
+
case 'from-top-right':
|
|
32
32
|
return `
|
|
33
33
|
M 1 0
|
|
34
34
|
L ${1 - progress * 2} 0
|
|
35
35
|
L 1 ${progress * 2}
|
|
36
36
|
Z`;
|
|
37
|
-
case
|
|
37
|
+
case 'from-right':
|
|
38
38
|
return `
|
|
39
39
|
M 1 0
|
|
40
40
|
L 1 1
|
|
41
41
|
L ${1 - progress} 1
|
|
42
42
|
L ${1 - progress} 0
|
|
43
43
|
Z`;
|
|
44
|
-
case
|
|
44
|
+
case 'from-bottom-right':
|
|
45
45
|
return `
|
|
46
46
|
M 1 1
|
|
47
47
|
L ${1 - progress * 2} 1
|
|
48
48
|
L 1 ${1 - progress * 2}
|
|
49
49
|
Z`;
|
|
50
|
-
case
|
|
50
|
+
case 'from-bottom':
|
|
51
51
|
return `
|
|
52
52
|
M 0 1
|
|
53
53
|
L 1 1
|
|
54
54
|
L 1 ${1 - progress}
|
|
55
55
|
L 0 ${1 - progress}
|
|
56
56
|
Z`;
|
|
57
|
-
case
|
|
57
|
+
case 'from-bottom-left':
|
|
58
58
|
return `
|
|
59
59
|
M 0 1
|
|
60
60
|
L 0 ${1 - progress * 2}
|
|
@@ -66,53 +66,53 @@ Z`;
|
|
|
66
66
|
};
|
|
67
67
|
const makePathOut = (progress, direction) => {
|
|
68
68
|
switch (direction) {
|
|
69
|
-
case
|
|
69
|
+
case 'from-left':
|
|
70
70
|
return `
|
|
71
71
|
M 1 1
|
|
72
72
|
L ${1 - progress} 1
|
|
73
73
|
L ${1 - progress} 0
|
|
74
74
|
L 1 0
|
|
75
75
|
Z`;
|
|
76
|
-
case
|
|
76
|
+
case 'from-top-left':
|
|
77
77
|
return `
|
|
78
78
|
M 1 1
|
|
79
79
|
L ${1 - 2 * progress} 1
|
|
80
80
|
L 1 ${1 - 2 * progress}
|
|
81
81
|
Z`;
|
|
82
|
-
case
|
|
82
|
+
case 'from-top':
|
|
83
83
|
return `
|
|
84
84
|
M 1 1
|
|
85
85
|
L 0 1
|
|
86
86
|
L 0 ${1 - progress}
|
|
87
87
|
L 1 ${1 - progress}
|
|
88
88
|
Z`;
|
|
89
|
-
case
|
|
89
|
+
case 'from-top-right':
|
|
90
90
|
return `
|
|
91
91
|
M 0 1
|
|
92
92
|
L ${progress * 2} 1
|
|
93
93
|
L 0 ${1 - progress * 2}
|
|
94
94
|
Z`;
|
|
95
|
-
case
|
|
95
|
+
case 'from-right':
|
|
96
96
|
return `
|
|
97
97
|
M 0 0
|
|
98
98
|
L ${progress} 0
|
|
99
99
|
L ${progress} 1
|
|
100
100
|
L 0 1
|
|
101
101
|
Z`;
|
|
102
|
-
case
|
|
102
|
+
case 'from-bottom-right':
|
|
103
103
|
return `
|
|
104
104
|
M 0 0
|
|
105
105
|
L ${progress * 2} 0
|
|
106
106
|
L 0 ${progress * 2}
|
|
107
107
|
Z`;
|
|
108
|
-
case
|
|
108
|
+
case 'from-bottom':
|
|
109
109
|
return `
|
|
110
110
|
M 1 0
|
|
111
111
|
L 0 0
|
|
112
112
|
L 0 ${progress}
|
|
113
113
|
L 1 ${progress}
|
|
114
114
|
Z`;
|
|
115
|
-
case
|
|
115
|
+
case 'from-bottom-left':
|
|
116
116
|
return `
|
|
117
117
|
M 1 0
|
|
118
118
|
L ${1 - progress * 2} 0
|
|
@@ -122,28 +122,28 @@ Z`;
|
|
|
122
122
|
throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
const WipePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction =
|
|
125
|
+
const WipePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = 'from-left' }, }) => {
|
|
126
126
|
const [clipId] = react.useState(() => String(remotion.random(null)));
|
|
127
|
-
const progressInDirection = presentationDirection ===
|
|
127
|
+
const progressInDirection = presentationDirection === 'entering'
|
|
128
128
|
? presentationProgress
|
|
129
129
|
: 1 - presentationProgress;
|
|
130
|
-
const path = presentationDirection ===
|
|
130
|
+
const path = presentationDirection === 'entering'
|
|
131
131
|
? makePathIn(progressInDirection, direction)
|
|
132
132
|
: makePathOut(progressInDirection, direction);
|
|
133
133
|
const style = react.useMemo(() => {
|
|
134
134
|
return {
|
|
135
|
-
width:
|
|
136
|
-
height:
|
|
137
|
-
justifyContent:
|
|
138
|
-
alignItems:
|
|
135
|
+
width: '100%',
|
|
136
|
+
height: '100%',
|
|
137
|
+
justifyContent: 'center',
|
|
138
|
+
alignItems: 'center',
|
|
139
139
|
clipPath: `url(#${clipId})`,
|
|
140
140
|
};
|
|
141
141
|
}, [clipId]);
|
|
142
142
|
const svgStyle = react.useMemo(() => {
|
|
143
143
|
return {
|
|
144
|
-
width:
|
|
145
|
-
height:
|
|
146
|
-
pointerEvents:
|
|
144
|
+
width: '100%',
|
|
145
|
+
height: '100%',
|
|
146
|
+
pointerEvents: 'none',
|
|
147
147
|
};
|
|
148
148
|
}, []);
|
|
149
149
|
return (jsxRuntime.jsxs(remotion.AbsoluteFill, { children: [jsxRuntime.jsx(remotion.AbsoluteFill, { style: style, children: children }), jsxRuntime.jsx(remotion.AbsoluteFill, { children: jsxRuntime.jsx("svg", { viewBox: "0 0 1 1", style: svgStyle, children: jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: clipId, clipPathUnits: "objectBoundingBox", children: jsxRuntime.jsx("path", { d: path, fill: "black" }) }) }) }) })] }));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export declare const flattenChildren: (children: React.ReactNode) => (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal)[];
|
package/dist/flatten-children.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
export { linearTiming } from './timings/linear-timing.js';
|
|
1
2
|
export { springTiming } from './timings/spring-timing.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { TransitionTiming, TransitionPresentation, TransitionPresentationComponentProps, } from "./types.js";
|
|
3
|
+
export { TransitionSeries } from './TransitionSeries.js';
|
|
4
|
+
export { TransitionPresentation, TransitionPresentationComponentProps, TransitionTiming, } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Timings
|
|
2
|
+
export { linearTiming } from './timings/linear-timing.js';
|
|
2
3
|
export { springTiming } from './timings/spring-timing.js';
|
|
3
|
-
export { linearTiming } from "./timings/linear-timing.js";
|
|
4
4
|
// Component
|
|
5
|
-
export { TransitionSeries } from
|
|
5
|
+
export { TransitionSeries } from './TransitionSeries.js';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { TransitionPresentation } from
|
|
2
|
-
type FadeProps = Record<string, never>;
|
|
1
|
+
import type { TransitionPresentation } from '../types.js';
|
|
2
|
+
export type FadeProps = Record<string, never>;
|
|
3
3
|
export declare const fade: (props?: FadeProps) => TransitionPresentation<FadeProps>;
|
|
4
|
-
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from
|
|
3
|
-
import { AbsoluteFill } from
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { AbsoluteFill } from 'remotion';
|
|
4
4
|
const FadePresentation = ({ children, presentationDirection, presentationProgress }) => {
|
|
5
5
|
const style = useMemo(() => {
|
|
6
6
|
return {
|
|
7
|
-
opacity: presentationDirection ===
|
|
7
|
+
opacity: presentationDirection === 'entering' ? presentationProgress : 1,
|
|
8
8
|
};
|
|
9
9
|
}, [presentationDirection, presentationProgress]);
|
|
10
10
|
return (_jsx(AbsoluteFill, { children: _jsx(AbsoluteFill, { style: style, children: children }) }));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { TransitionPresentation } from '../types.js';
|
|
2
2
|
export type FlipDirection = 'from-left' | 'from-right' | 'from-top' | 'from-bottom';
|
|
3
|
-
type
|
|
3
|
+
export type FlipProps = {
|
|
4
4
|
direction?: FlipDirection;
|
|
5
5
|
perspective?: number;
|
|
6
6
|
};
|
|
7
|
-
export declare const flip: (props?:
|
|
8
|
-
export {};
|
|
7
|
+
export declare const flip: (props?: FlipProps) => TransitionPresentation<FlipProps>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { TransitionPresentation } from
|
|
2
|
-
export type SlideDirection =
|
|
3
|
-
type SlideProps = {
|
|
1
|
+
import type { TransitionPresentation } from '../types.js';
|
|
2
|
+
export type SlideDirection = 'from-left' | 'from-top' | 'from-right' | 'from-bottom';
|
|
3
|
+
export type SlideProps = {
|
|
4
4
|
direction?: SlideDirection;
|
|
5
5
|
};
|
|
6
6
|
export declare const slide: (props?: SlideProps) => TransitionPresentation<SlideProps>;
|
|
7
|
-
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from
|
|
3
|
-
import { AbsoluteFill } from
|
|
4
|
-
const SlidePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction =
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { AbsoluteFill } from 'remotion';
|
|
4
|
+
const SlidePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = 'from-left' }, }) => {
|
|
5
5
|
const directionStyle = useMemo(() => {
|
|
6
|
-
if (presentationDirection ===
|
|
6
|
+
if (presentationDirection === 'exiting') {
|
|
7
7
|
switch (direction) {
|
|
8
|
-
case
|
|
8
|
+
case 'from-left':
|
|
9
9
|
return {
|
|
10
10
|
transform: `translateX(${presentationProgress * 100}%)`,
|
|
11
11
|
};
|
|
12
|
-
case
|
|
12
|
+
case 'from-right':
|
|
13
13
|
return {
|
|
14
14
|
transform: `translateX(-${presentationProgress * 100}%)`,
|
|
15
15
|
};
|
|
16
|
-
case
|
|
16
|
+
case 'from-top':
|
|
17
17
|
return {
|
|
18
18
|
transform: `translateY(${presentationProgress * 100}%)`,
|
|
19
19
|
};
|
|
20
|
-
case
|
|
20
|
+
case 'from-bottom':
|
|
21
21
|
return {
|
|
22
22
|
transform: `translateY(-${presentationProgress * 100}%)`,
|
|
23
23
|
};
|
|
@@ -26,19 +26,19 @@ const SlidePresentation = ({ children, presentationProgress, presentationDirecti
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
switch (direction) {
|
|
29
|
-
case
|
|
29
|
+
case 'from-left':
|
|
30
30
|
return {
|
|
31
31
|
transform: `translateX(${-100 + presentationProgress * 100}%)`,
|
|
32
32
|
};
|
|
33
|
-
case
|
|
33
|
+
case 'from-right':
|
|
34
34
|
return {
|
|
35
35
|
transform: `translateX(${100 - presentationProgress * 100}%)`,
|
|
36
36
|
};
|
|
37
|
-
case
|
|
37
|
+
case 'from-top':
|
|
38
38
|
return {
|
|
39
39
|
transform: `translateY(${-100 + presentationProgress * 100}%)`,
|
|
40
40
|
};
|
|
41
|
-
case
|
|
41
|
+
case 'from-bottom':
|
|
42
42
|
return {
|
|
43
43
|
transform: `translateY(${100 - presentationProgress * 100}%)`,
|
|
44
44
|
};
|
|
@@ -48,10 +48,10 @@ const SlidePresentation = ({ children, presentationProgress, presentationDirecti
|
|
|
48
48
|
}, [presentationDirection, presentationProgress, direction]);
|
|
49
49
|
const style = useMemo(() => {
|
|
50
50
|
return {
|
|
51
|
-
width:
|
|
52
|
-
height:
|
|
53
|
-
justifyContent:
|
|
54
|
-
alignItems:
|
|
51
|
+
width: '100%',
|
|
52
|
+
height: '100%',
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
alignItems: 'center',
|
|
55
55
|
...directionStyle,
|
|
56
56
|
};
|
|
57
57
|
}, [directionStyle]);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { TransitionPresentation } from
|
|
2
|
-
export type WipeDirection =
|
|
3
|
-
type WipeProps = {
|
|
1
|
+
import type { TransitionPresentation } from '../types.js';
|
|
2
|
+
export type WipeDirection = 'from-left' | 'from-top-left' | 'from-top' | 'from-top-right' | 'from-right' | 'from-bottom-right' | 'from-bottom' | 'from-bottom-left';
|
|
3
|
+
export type WipeProps = {
|
|
4
4
|
direction?: WipeDirection;
|
|
5
5
|
};
|
|
6
6
|
export declare const wipe: (props?: WipeProps) => TransitionPresentation<WipeProps>;
|
|
7
|
-
export {};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState } from
|
|
3
|
-
import { AbsoluteFill, random } from
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { AbsoluteFill, random } from 'remotion';
|
|
4
4
|
const makePathIn = (progress, direction) => {
|
|
5
5
|
switch (direction) {
|
|
6
|
-
case
|
|
6
|
+
case 'from-left':
|
|
7
7
|
return `
|
|
8
8
|
M 0 0
|
|
9
9
|
L ${progress} 0
|
|
10
10
|
L ${progress} 1
|
|
11
11
|
L 0 1
|
|
12
12
|
Z`;
|
|
13
|
-
case
|
|
13
|
+
case 'from-top-left':
|
|
14
14
|
return `
|
|
15
15
|
M 0 0
|
|
16
16
|
L ${progress * 2} 0
|
|
17
17
|
L 0 ${progress * 2}
|
|
18
18
|
Z`;
|
|
19
|
-
case
|
|
19
|
+
case 'from-top':
|
|
20
20
|
return `
|
|
21
21
|
M 0 0
|
|
22
22
|
L 1 0
|
|
23
23
|
L 1 ${progress}
|
|
24
24
|
L 0 ${progress}
|
|
25
25
|
Z`;
|
|
26
|
-
case
|
|
26
|
+
case 'from-top-right':
|
|
27
27
|
return `
|
|
28
28
|
M 1 0
|
|
29
29
|
L ${1 - progress * 2} 0
|
|
30
30
|
L 1 ${progress * 2}
|
|
31
31
|
Z`;
|
|
32
|
-
case
|
|
32
|
+
case 'from-right':
|
|
33
33
|
return `
|
|
34
34
|
M 1 0
|
|
35
35
|
L 1 1
|
|
36
36
|
L ${1 - progress} 1
|
|
37
37
|
L ${1 - progress} 0
|
|
38
38
|
Z`;
|
|
39
|
-
case
|
|
39
|
+
case 'from-bottom-right':
|
|
40
40
|
return `
|
|
41
41
|
M 1 1
|
|
42
42
|
L ${1 - progress * 2} 1
|
|
43
43
|
L 1 ${1 - progress * 2}
|
|
44
44
|
Z`;
|
|
45
|
-
case
|
|
45
|
+
case 'from-bottom':
|
|
46
46
|
return `
|
|
47
47
|
M 0 1
|
|
48
48
|
L 1 1
|
|
49
49
|
L 1 ${1 - progress}
|
|
50
50
|
L 0 ${1 - progress}
|
|
51
51
|
Z`;
|
|
52
|
-
case
|
|
52
|
+
case 'from-bottom-left':
|
|
53
53
|
return `
|
|
54
54
|
M 0 1
|
|
55
55
|
L 0 ${1 - progress * 2}
|
|
@@ -61,53 +61,53 @@ Z`;
|
|
|
61
61
|
};
|
|
62
62
|
const makePathOut = (progress, direction) => {
|
|
63
63
|
switch (direction) {
|
|
64
|
-
case
|
|
64
|
+
case 'from-left':
|
|
65
65
|
return `
|
|
66
66
|
M 1 1
|
|
67
67
|
L ${1 - progress} 1
|
|
68
68
|
L ${1 - progress} 0
|
|
69
69
|
L 1 0
|
|
70
70
|
Z`;
|
|
71
|
-
case
|
|
71
|
+
case 'from-top-left':
|
|
72
72
|
return `
|
|
73
73
|
M 1 1
|
|
74
74
|
L ${1 - 2 * progress} 1
|
|
75
75
|
L 1 ${1 - 2 * progress}
|
|
76
76
|
Z`;
|
|
77
|
-
case
|
|
77
|
+
case 'from-top':
|
|
78
78
|
return `
|
|
79
79
|
M 1 1
|
|
80
80
|
L 0 1
|
|
81
81
|
L 0 ${1 - progress}
|
|
82
82
|
L 1 ${1 - progress}
|
|
83
83
|
Z`;
|
|
84
|
-
case
|
|
84
|
+
case 'from-top-right':
|
|
85
85
|
return `
|
|
86
86
|
M 0 1
|
|
87
87
|
L ${progress * 2} 1
|
|
88
88
|
L 0 ${1 - progress * 2}
|
|
89
89
|
Z`;
|
|
90
|
-
case
|
|
90
|
+
case 'from-right':
|
|
91
91
|
return `
|
|
92
92
|
M 0 0
|
|
93
93
|
L ${progress} 0
|
|
94
94
|
L ${progress} 1
|
|
95
95
|
L 0 1
|
|
96
96
|
Z`;
|
|
97
|
-
case
|
|
97
|
+
case 'from-bottom-right':
|
|
98
98
|
return `
|
|
99
99
|
M 0 0
|
|
100
100
|
L ${progress * 2} 0
|
|
101
101
|
L 0 ${progress * 2}
|
|
102
102
|
Z`;
|
|
103
|
-
case
|
|
103
|
+
case 'from-bottom':
|
|
104
104
|
return `
|
|
105
105
|
M 1 0
|
|
106
106
|
L 0 0
|
|
107
107
|
L 0 ${progress}
|
|
108
108
|
L 1 ${progress}
|
|
109
109
|
Z`;
|
|
110
|
-
case
|
|
110
|
+
case 'from-bottom-left':
|
|
111
111
|
return `
|
|
112
112
|
M 1 0
|
|
113
113
|
L ${1 - progress * 2} 0
|
|
@@ -117,28 +117,28 @@ Z`;
|
|
|
117
117
|
throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
const WipePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction =
|
|
120
|
+
const WipePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = 'from-left' }, }) => {
|
|
121
121
|
const [clipId] = useState(() => String(random(null)));
|
|
122
|
-
const progressInDirection = presentationDirection ===
|
|
122
|
+
const progressInDirection = presentationDirection === 'entering'
|
|
123
123
|
? presentationProgress
|
|
124
124
|
: 1 - presentationProgress;
|
|
125
|
-
const path = presentationDirection ===
|
|
125
|
+
const path = presentationDirection === 'entering'
|
|
126
126
|
? makePathIn(progressInDirection, direction)
|
|
127
127
|
: makePathOut(progressInDirection, direction);
|
|
128
128
|
const style = useMemo(() => {
|
|
129
129
|
return {
|
|
130
|
-
width:
|
|
131
|
-
height:
|
|
132
|
-
justifyContent:
|
|
133
|
-
alignItems:
|
|
130
|
+
width: '100%',
|
|
131
|
+
height: '100%',
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
alignItems: 'center',
|
|
134
134
|
clipPath: `url(#${clipId})`,
|
|
135
135
|
};
|
|
136
136
|
}, [clipId]);
|
|
137
137
|
const svgStyle = useMemo(() => {
|
|
138
138
|
return {
|
|
139
|
-
width:
|
|
140
|
-
height:
|
|
141
|
-
pointerEvents:
|
|
139
|
+
width: '100%',
|
|
140
|
+
height: '100%',
|
|
141
|
+
pointerEvents: 'none',
|
|
142
142
|
};
|
|
143
143
|
}, []);
|
|
144
144
|
return (_jsxs(AbsoluteFill, { children: [_jsx(AbsoluteFill, { style: style, children: children }), _jsx(AbsoluteFill, { children: _jsx("svg", { viewBox: "0 0 1 1", style: svgStyle, children: _jsx("defs", { children: _jsx("clipPath", { id: clipId, clipPathUnits: "objectBoundingBox", children: _jsx("path", { d: path, fill: "black" }) }) }) }) })] }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SpringConfig } from
|
|
2
|
-
import type { TransitionTiming } from
|
|
1
|
+
import type { SpringConfig } from 'remotion';
|
|
2
|
+
import type { TransitionTiming } from '../types.js';
|
|
3
3
|
export declare const springTiming: (options?: {
|
|
4
4
|
config?: Partial<SpringConfig>;
|
|
5
5
|
durationInFrames?: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { measureSpring, spring } from
|
|
1
|
+
import { measureSpring, spring } from 'remotion';
|
|
2
2
|
const springWithInvalidArgumentRejection = (args) => {
|
|
3
3
|
if (args.to || args.from) {
|
|
4
|
-
throw new Error(
|
|
4
|
+
throw new Error('to / from values are not supported by springWithRoundUpIfThreshold');
|
|
5
5
|
}
|
|
6
6
|
return spring(args);
|
|
7
7
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentType } from
|
|
2
|
-
export type PresentationDirection =
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
export type PresentationDirection = 'entering' | 'exiting';
|
|
3
3
|
export type TransitionTiming = {
|
|
4
4
|
getDurationInFrames: (options: {
|
|
5
5
|
fps: number;
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Internals } from
|
|
1
|
+
import { Internals } from 'remotion';
|
|
2
2
|
export declare const validateDurationInFrames: typeof Internals.validateDurationInFrames;
|
package/dist/validate.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/transitions",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.58",
|
|
4
4
|
"description": "Transition presets for Remotion",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"remotion": "4.0.
|
|
19
|
+
"remotion": "4.0.58"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@jonny/eslint-config": "3.0.276",
|
|
23
23
|
"eslint": "8.42.0",
|
|
24
24
|
"prettier": "3.0.2",
|
|
25
25
|
"prettier-plugin-organize-imports": "^3.2.2",
|
|
26
|
-
"react": "18.
|
|
27
|
-
"react-dom": "18.
|
|
26
|
+
"react": "18.2.0",
|
|
27
|
+
"react-dom": "18.2.0",
|
|
28
28
|
"vitest": "0.31.1",
|
|
29
29
|
"@types/react": "18.0.26",
|
|
30
30
|
"@types/react-dom": "18.0.11",
|
|
31
31
|
"@vitejs/plugin-react": "^2.0.0",
|
|
32
32
|
"rollup": "^2.70.1",
|
|
33
33
|
"@rollup/plugin-typescript": "^8.2.0",
|
|
34
|
-
"remotion": "4.0.
|
|
35
|
-
"@remotion/test-utils": "4.0.
|
|
34
|
+
"remotion": "4.0.58",
|
|
35
|
+
"@remotion/test-utils": "4.0.58"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=16.8.0",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
"scripts": {
|
|
98
98
|
"lint": "eslint src --ext ts,tsx",
|
|
99
|
+
"formatting": "prettier src --check",
|
|
99
100
|
"watch": "tsc -w",
|
|
100
101
|
"build": "rollup --config rollup.config.js && tsc -d"
|
|
101
102
|
}
|