@remotion/transitions 4.0.53
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/LICENSE.md +45 -0
- package/dist/TransitionSeries.d.ts +15 -0
- package/dist/TransitionSeries.js +150 -0
- package/dist/cjs/TransitionSeries.d.ts +15 -0
- package/dist/cjs/fade.js +24 -0
- package/dist/cjs/flatten-children.d.ts +2 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +282 -0
- package/dist/cjs/presentations/fade.d.ts +4 -0
- package/dist/cjs/presentations/slide.d.ts +7 -0
- package/dist/cjs/presentations/wipe.d.ts +7 -0
- package/dist/cjs/slide.js +72 -0
- package/dist/cjs/test/transitions.test.d.ts +1 -0
- package/dist/cjs/timings/linear-timing.d.ts +5 -0
- package/dist/cjs/timings/spring-timing.d.ts +7 -0
- package/dist/cjs/types.d.ts +27 -0
- package/dist/cjs/validate.d.ts +2 -0
- package/dist/cjs/wipe.js +158 -0
- package/dist/flatten-children.d.ts +2 -0
- package/dist/flatten-children.js +12 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/presentations/fade.d.ts +4 -0
- package/dist/presentations/fade.js +17 -0
- package/dist/presentations/slide.d.ts +7 -0
- package/dist/presentations/slide.js +65 -0
- package/dist/presentations/wipe.d.ts +7 -0
- package/dist/presentations/wipe.js +151 -0
- package/dist/timings/linear-timing.d.ts +5 -0
- package/dist/timings/linear-timing.js +15 -0
- package/dist/timings/spring-timing.d.ts +7 -0
- package/dist/timings/spring-timing.js +30 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +1 -0
- package/dist/validate.d.ts +2 -0
- package/dist/validate.js +3 -0
- package/package.json +93 -0
- package/rollup.config.js +77 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
export type PresentationDirection = "entering" | "exiting";
|
|
3
|
+
export type TransitionTiming = {
|
|
4
|
+
getDurationInFrames: (options: {
|
|
5
|
+
fps: number;
|
|
6
|
+
}) => number;
|
|
7
|
+
getProgress: (options: {
|
|
8
|
+
frame: number;
|
|
9
|
+
fps: number;
|
|
10
|
+
}) => number;
|
|
11
|
+
};
|
|
12
|
+
export type TransitionSeriesTransitionProps<PresentationProps extends Record<string, unknown>> = {
|
|
13
|
+
timing: TransitionTiming;
|
|
14
|
+
presentation?: TransitionPresentation<PresentationProps>;
|
|
15
|
+
};
|
|
16
|
+
type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
|
|
17
|
+
export type TransitionPresentation<PresentationProps extends Record<string, unknown>> = {
|
|
18
|
+
component: LooseComponentType<TransitionPresentationComponentProps<PresentationProps>>;
|
|
19
|
+
props: PresentationProps;
|
|
20
|
+
};
|
|
21
|
+
export type TransitionPresentationComponentProps<PresentationProps extends Record<string, unknown>> = {
|
|
22
|
+
presentationProgress: number;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
presentationDirection: PresentationDirection;
|
|
25
|
+
passedProps: PresentationProps;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
package/dist/cjs/wipe.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var remotion = require('remotion');
|
|
8
|
+
|
|
9
|
+
const makePathIn = (progress, direction) => {
|
|
10
|
+
switch (direction) {
|
|
11
|
+
case "from-left":
|
|
12
|
+
return `
|
|
13
|
+
M 0 0
|
|
14
|
+
L ${progress} 0
|
|
15
|
+
L ${progress} 1
|
|
16
|
+
L 0 1
|
|
17
|
+
Z`;
|
|
18
|
+
case "from-top-left":
|
|
19
|
+
return `
|
|
20
|
+
M 0 0
|
|
21
|
+
L ${progress * 2} 0
|
|
22
|
+
L 0 ${progress * 2}
|
|
23
|
+
Z`;
|
|
24
|
+
case "from-top":
|
|
25
|
+
return `
|
|
26
|
+
M 0 0
|
|
27
|
+
L 1 0
|
|
28
|
+
L 1 ${progress}
|
|
29
|
+
L 0 ${progress}
|
|
30
|
+
Z`;
|
|
31
|
+
case "from-top-right":
|
|
32
|
+
return `
|
|
33
|
+
M 1 0
|
|
34
|
+
L ${1 - progress * 2} 0
|
|
35
|
+
L 1 ${progress * 2}
|
|
36
|
+
Z`;
|
|
37
|
+
case "from-right":
|
|
38
|
+
return `
|
|
39
|
+
M 1 0
|
|
40
|
+
L 1 1
|
|
41
|
+
L ${1 - progress} 1
|
|
42
|
+
L ${1 - progress} 0
|
|
43
|
+
Z`;
|
|
44
|
+
case "from-bottom-right":
|
|
45
|
+
return `
|
|
46
|
+
M 1 1
|
|
47
|
+
L ${1 - progress * 2} 1
|
|
48
|
+
L 1 ${1 - progress * 2}
|
|
49
|
+
Z`;
|
|
50
|
+
case "from-bottom":
|
|
51
|
+
return `
|
|
52
|
+
M 0 1
|
|
53
|
+
L 1 1
|
|
54
|
+
L 1 ${1 - progress}
|
|
55
|
+
L 0 ${1 - progress}
|
|
56
|
+
Z`;
|
|
57
|
+
case "from-bottom-left":
|
|
58
|
+
return `
|
|
59
|
+
M 0 1
|
|
60
|
+
L 0 ${1 - progress * 2}
|
|
61
|
+
L ${progress * 2} 1
|
|
62
|
+
Z`;
|
|
63
|
+
default:
|
|
64
|
+
throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const makePathOut = (progress, direction) => {
|
|
68
|
+
switch (direction) {
|
|
69
|
+
case "from-left":
|
|
70
|
+
return `
|
|
71
|
+
M 1 1
|
|
72
|
+
L ${1 - progress} 1
|
|
73
|
+
L ${1 - progress} 0
|
|
74
|
+
L 1 0
|
|
75
|
+
Z`;
|
|
76
|
+
case "from-top-left":
|
|
77
|
+
return `
|
|
78
|
+
M 1 1
|
|
79
|
+
L ${1 - 2 * progress} 1
|
|
80
|
+
L 1 ${1 - 2 * progress}
|
|
81
|
+
Z`;
|
|
82
|
+
case "from-top":
|
|
83
|
+
return `
|
|
84
|
+
M 1 1
|
|
85
|
+
L 0 1
|
|
86
|
+
L 0 ${1 - progress}
|
|
87
|
+
L 1 ${1 - progress}
|
|
88
|
+
Z`;
|
|
89
|
+
case "from-top-right":
|
|
90
|
+
return `
|
|
91
|
+
M 0 1
|
|
92
|
+
L ${progress * 2} 1
|
|
93
|
+
L 0 ${1 - progress * 2}
|
|
94
|
+
Z`;
|
|
95
|
+
case "from-right":
|
|
96
|
+
return `
|
|
97
|
+
M 0 0
|
|
98
|
+
L ${progress} 0
|
|
99
|
+
L ${progress} 1
|
|
100
|
+
L 0 1
|
|
101
|
+
Z`;
|
|
102
|
+
case "from-bottom-right":
|
|
103
|
+
return `
|
|
104
|
+
M 0 0
|
|
105
|
+
L ${progress * 2} 0
|
|
106
|
+
L 0 ${progress * 2}
|
|
107
|
+
Z`;
|
|
108
|
+
case "from-bottom":
|
|
109
|
+
return `
|
|
110
|
+
M 1 0
|
|
111
|
+
L 0 0
|
|
112
|
+
L 0 ${progress}
|
|
113
|
+
L 1 ${progress}
|
|
114
|
+
Z`;
|
|
115
|
+
case "from-bottom-left":
|
|
116
|
+
return `
|
|
117
|
+
M 1 0
|
|
118
|
+
L ${1 - progress * 2} 0
|
|
119
|
+
L 1 ${progress * 2}
|
|
120
|
+
Z`;
|
|
121
|
+
default:
|
|
122
|
+
throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const WipePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = "from-left" }, }) => {
|
|
126
|
+
const [clipId] = react.useState(() => String(remotion.random(null)));
|
|
127
|
+
const progressInDirection = presentationDirection === "entering"
|
|
128
|
+
? presentationProgress
|
|
129
|
+
: 1 - presentationProgress;
|
|
130
|
+
const path = presentationDirection === "entering"
|
|
131
|
+
? makePathIn(progressInDirection, direction)
|
|
132
|
+
: makePathOut(progressInDirection, direction);
|
|
133
|
+
const style = react.useMemo(() => {
|
|
134
|
+
return {
|
|
135
|
+
width: "100%",
|
|
136
|
+
height: "100%",
|
|
137
|
+
justifyContent: "center",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
clipPath: `url(#${clipId})`,
|
|
140
|
+
};
|
|
141
|
+
}, [clipId]);
|
|
142
|
+
const svgStyle = react.useMemo(() => {
|
|
143
|
+
return {
|
|
144
|
+
width: "100%",
|
|
145
|
+
height: "100%",
|
|
146
|
+
pointerEvents: "none",
|
|
147
|
+
};
|
|
148
|
+
}, []);
|
|
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" }) }) }) }) })] }));
|
|
150
|
+
};
|
|
151
|
+
const wipe = (props) => {
|
|
152
|
+
return {
|
|
153
|
+
component: WipePresentation,
|
|
154
|
+
props: props !== null && props !== void 0 ? props : {},
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
exports.wipe = wipe;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export const flattenChildren = (children) => {
|
|
3
|
+
const childrenArray = React.Children.toArray(children);
|
|
4
|
+
return childrenArray.reduce((flatChildren, child) => {
|
|
5
|
+
if (child.type === React.Fragment) {
|
|
6
|
+
return flatChildren.concat(flattenChildren(child.props
|
|
7
|
+
.children));
|
|
8
|
+
}
|
|
9
|
+
flatChildren.push(child);
|
|
10
|
+
return flatChildren;
|
|
11
|
+
}, []);
|
|
12
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { springTiming } from './timings/spring-timing.js';
|
|
2
|
+
export { linearTiming } from "./timings/linear-timing.js";
|
|
3
|
+
export { TransitionSeries } from "./TransitionSeries.js";
|
|
4
|
+
export { TransitionTiming, TransitionPresentation, TransitionPresentationComponentProps, } from "./types.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { AbsoluteFill } from "remotion";
|
|
4
|
+
const FadePresentation = ({ children, presentationDirection, presentationProgress }) => {
|
|
5
|
+
const style = useMemo(() => {
|
|
6
|
+
return {
|
|
7
|
+
opacity: presentationDirection === "entering" ? presentationProgress : 1,
|
|
8
|
+
};
|
|
9
|
+
}, [presentationDirection, presentationProgress]);
|
|
10
|
+
return (_jsx(AbsoluteFill, { children: _jsx(AbsoluteFill, { style: style, children: children }) }));
|
|
11
|
+
};
|
|
12
|
+
export const fade = (props) => {
|
|
13
|
+
return {
|
|
14
|
+
component: FadePresentation,
|
|
15
|
+
props: props !== null && props !== void 0 ? props : {},
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TransitionPresentation } from "../types.js";
|
|
2
|
+
export type SlideDirection = "from-left" | "from-top" | "from-right" | "from-bottom";
|
|
3
|
+
type SlideProps = {
|
|
4
|
+
direction?: SlideDirection;
|
|
5
|
+
};
|
|
6
|
+
export declare const slide: (props?: SlideProps) => TransitionPresentation<SlideProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { AbsoluteFill } from "remotion";
|
|
4
|
+
const SlidePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = "from-left" }, }) => {
|
|
5
|
+
const directionStyle = useMemo(() => {
|
|
6
|
+
if (presentationDirection === "exiting") {
|
|
7
|
+
switch (direction) {
|
|
8
|
+
case "from-left":
|
|
9
|
+
return {
|
|
10
|
+
transform: `translateX(${presentationProgress * 100}%)`,
|
|
11
|
+
};
|
|
12
|
+
case "from-right":
|
|
13
|
+
return {
|
|
14
|
+
transform: `translateX(-${presentationProgress * 100}%)`,
|
|
15
|
+
};
|
|
16
|
+
case "from-top":
|
|
17
|
+
return {
|
|
18
|
+
transform: `translateY(${presentationProgress * 100}%)`,
|
|
19
|
+
};
|
|
20
|
+
case "from-bottom":
|
|
21
|
+
return {
|
|
22
|
+
transform: `translateY(-${presentationProgress * 100}%)`,
|
|
23
|
+
};
|
|
24
|
+
default:
|
|
25
|
+
throw new Error(`Invalid direction: ${direction}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
switch (direction) {
|
|
29
|
+
case "from-left":
|
|
30
|
+
return {
|
|
31
|
+
transform: `translateX(${-100 + presentationProgress * 100}%)`,
|
|
32
|
+
};
|
|
33
|
+
case "from-right":
|
|
34
|
+
return {
|
|
35
|
+
transform: `translateX(${100 - presentationProgress * 100}%)`,
|
|
36
|
+
};
|
|
37
|
+
case "from-top":
|
|
38
|
+
return {
|
|
39
|
+
transform: `translateY(${-100 + presentationProgress * 100}%)`,
|
|
40
|
+
};
|
|
41
|
+
case "from-bottom":
|
|
42
|
+
return {
|
|
43
|
+
transform: `translateY(${100 - presentationProgress * 100}%)`,
|
|
44
|
+
};
|
|
45
|
+
default:
|
|
46
|
+
throw new Error(`Invalid direction: ${direction}`);
|
|
47
|
+
}
|
|
48
|
+
}, [presentationDirection, presentationProgress, direction]);
|
|
49
|
+
const style = useMemo(() => {
|
|
50
|
+
return {
|
|
51
|
+
width: "100%",
|
|
52
|
+
height: "100%",
|
|
53
|
+
justifyContent: "center",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
...directionStyle,
|
|
56
|
+
};
|
|
57
|
+
}, [directionStyle]);
|
|
58
|
+
return (_jsx(AbsoluteFill, { children: _jsx(AbsoluteFill, { style: style, children: children }) }));
|
|
59
|
+
};
|
|
60
|
+
export const slide = (props) => {
|
|
61
|
+
return {
|
|
62
|
+
component: SlidePresentation,
|
|
63
|
+
props: props !== null && props !== void 0 ? props : {},
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
type WipeProps = {
|
|
4
|
+
direction?: WipeDirection;
|
|
5
|
+
};
|
|
6
|
+
export declare const wipe: (props?: WipeProps) => TransitionPresentation<WipeProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { AbsoluteFill, random } from "remotion";
|
|
4
|
+
const makePathIn = (progress, direction) => {
|
|
5
|
+
switch (direction) {
|
|
6
|
+
case "from-left":
|
|
7
|
+
return `
|
|
8
|
+
M 0 0
|
|
9
|
+
L ${progress} 0
|
|
10
|
+
L ${progress} 1
|
|
11
|
+
L 0 1
|
|
12
|
+
Z`;
|
|
13
|
+
case "from-top-left":
|
|
14
|
+
return `
|
|
15
|
+
M 0 0
|
|
16
|
+
L ${progress * 2} 0
|
|
17
|
+
L 0 ${progress * 2}
|
|
18
|
+
Z`;
|
|
19
|
+
case "from-top":
|
|
20
|
+
return `
|
|
21
|
+
M 0 0
|
|
22
|
+
L 1 0
|
|
23
|
+
L 1 ${progress}
|
|
24
|
+
L 0 ${progress}
|
|
25
|
+
Z`;
|
|
26
|
+
case "from-top-right":
|
|
27
|
+
return `
|
|
28
|
+
M 1 0
|
|
29
|
+
L ${1 - progress * 2} 0
|
|
30
|
+
L 1 ${progress * 2}
|
|
31
|
+
Z`;
|
|
32
|
+
case "from-right":
|
|
33
|
+
return `
|
|
34
|
+
M 1 0
|
|
35
|
+
L 1 1
|
|
36
|
+
L ${1 - progress} 1
|
|
37
|
+
L ${1 - progress} 0
|
|
38
|
+
Z`;
|
|
39
|
+
case "from-bottom-right":
|
|
40
|
+
return `
|
|
41
|
+
M 1 1
|
|
42
|
+
L ${1 - progress * 2} 1
|
|
43
|
+
L 1 ${1 - progress * 2}
|
|
44
|
+
Z`;
|
|
45
|
+
case "from-bottom":
|
|
46
|
+
return `
|
|
47
|
+
M 0 1
|
|
48
|
+
L 1 1
|
|
49
|
+
L 1 ${1 - progress}
|
|
50
|
+
L 0 ${1 - progress}
|
|
51
|
+
Z`;
|
|
52
|
+
case "from-bottom-left":
|
|
53
|
+
return `
|
|
54
|
+
M 0 1
|
|
55
|
+
L 0 ${1 - progress * 2}
|
|
56
|
+
L ${progress * 2} 1
|
|
57
|
+
Z`;
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const makePathOut = (progress, direction) => {
|
|
63
|
+
switch (direction) {
|
|
64
|
+
case "from-left":
|
|
65
|
+
return `
|
|
66
|
+
M 1 1
|
|
67
|
+
L ${1 - progress} 1
|
|
68
|
+
L ${1 - progress} 0
|
|
69
|
+
L 1 0
|
|
70
|
+
Z`;
|
|
71
|
+
case "from-top-left":
|
|
72
|
+
return `
|
|
73
|
+
M 1 1
|
|
74
|
+
L ${1 - 2 * progress} 1
|
|
75
|
+
L 1 ${1 - 2 * progress}
|
|
76
|
+
Z`;
|
|
77
|
+
case "from-top":
|
|
78
|
+
return `
|
|
79
|
+
M 1 1
|
|
80
|
+
L 0 1
|
|
81
|
+
L 0 ${1 - progress}
|
|
82
|
+
L 1 ${1 - progress}
|
|
83
|
+
Z`;
|
|
84
|
+
case "from-top-right":
|
|
85
|
+
return `
|
|
86
|
+
M 0 1
|
|
87
|
+
L ${progress * 2} 1
|
|
88
|
+
L 0 ${1 - progress * 2}
|
|
89
|
+
Z`;
|
|
90
|
+
case "from-right":
|
|
91
|
+
return `
|
|
92
|
+
M 0 0
|
|
93
|
+
L ${progress} 0
|
|
94
|
+
L ${progress} 1
|
|
95
|
+
L 0 1
|
|
96
|
+
Z`;
|
|
97
|
+
case "from-bottom-right":
|
|
98
|
+
return `
|
|
99
|
+
M 0 0
|
|
100
|
+
L ${progress * 2} 0
|
|
101
|
+
L 0 ${progress * 2}
|
|
102
|
+
Z`;
|
|
103
|
+
case "from-bottom":
|
|
104
|
+
return `
|
|
105
|
+
M 1 0
|
|
106
|
+
L 0 0
|
|
107
|
+
L 0 ${progress}
|
|
108
|
+
L 1 ${progress}
|
|
109
|
+
Z`;
|
|
110
|
+
case "from-bottom-left":
|
|
111
|
+
return `
|
|
112
|
+
M 1 0
|
|
113
|
+
L ${1 - progress * 2} 0
|
|
114
|
+
L 1 ${progress * 2}
|
|
115
|
+
Z`;
|
|
116
|
+
default:
|
|
117
|
+
throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const WipePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = "from-left" }, }) => {
|
|
121
|
+
const [clipId] = useState(() => String(random(null)));
|
|
122
|
+
const progressInDirection = presentationDirection === "entering"
|
|
123
|
+
? presentationProgress
|
|
124
|
+
: 1 - presentationProgress;
|
|
125
|
+
const path = presentationDirection === "entering"
|
|
126
|
+
? makePathIn(progressInDirection, direction)
|
|
127
|
+
: makePathOut(progressInDirection, direction);
|
|
128
|
+
const style = useMemo(() => {
|
|
129
|
+
return {
|
|
130
|
+
width: "100%",
|
|
131
|
+
height: "100%",
|
|
132
|
+
justifyContent: "center",
|
|
133
|
+
alignItems: "center",
|
|
134
|
+
clipPath: `url(#${clipId})`,
|
|
135
|
+
};
|
|
136
|
+
}, [clipId]);
|
|
137
|
+
const svgStyle = useMemo(() => {
|
|
138
|
+
return {
|
|
139
|
+
width: "100%",
|
|
140
|
+
height: "100%",
|
|
141
|
+
pointerEvents: "none",
|
|
142
|
+
};
|
|
143
|
+
}, []);
|
|
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" }) }) }) }) })] }));
|
|
145
|
+
};
|
|
146
|
+
export const wipe = (props) => {
|
|
147
|
+
return {
|
|
148
|
+
component: WipePresentation,
|
|
149
|
+
props: props !== null && props !== void 0 ? props : {},
|
|
150
|
+
};
|
|
151
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { interpolate } from 'remotion';
|
|
2
|
+
export const linearTiming = (options) => {
|
|
3
|
+
return {
|
|
4
|
+
getDurationInFrames: () => {
|
|
5
|
+
return options.durationInFrames;
|
|
6
|
+
},
|
|
7
|
+
getProgress: ({ frame }) => {
|
|
8
|
+
return interpolate(frame, [0, options.durationInFrames], [0, 1], {
|
|
9
|
+
easing: options.easing,
|
|
10
|
+
extrapolateLeft: 'clamp',
|
|
11
|
+
extrapolateRight: 'clamp',
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SpringConfig } from "remotion";
|
|
2
|
+
import type { TransitionTiming } from "../types.js";
|
|
3
|
+
export declare const springTiming: (options?: {
|
|
4
|
+
config?: Partial<SpringConfig>;
|
|
5
|
+
durationInFrames?: number;
|
|
6
|
+
durationRestThreshold?: number;
|
|
7
|
+
}) => TransitionTiming;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { measureSpring, spring } from "remotion";
|
|
2
|
+
const springWithInvalidArgumentRejection = (args) => {
|
|
3
|
+
if (args.to || args.from) {
|
|
4
|
+
throw new Error("to / from values are not supported by springWithRoundUpIfThreshold");
|
|
5
|
+
}
|
|
6
|
+
return spring(args);
|
|
7
|
+
};
|
|
8
|
+
export const springTiming = (options = {}) => {
|
|
9
|
+
return {
|
|
10
|
+
getDurationInFrames: ({ fps }) => {
|
|
11
|
+
if (options.durationInFrames) {
|
|
12
|
+
return options.durationInFrames;
|
|
13
|
+
}
|
|
14
|
+
return measureSpring({
|
|
15
|
+
config: options.config,
|
|
16
|
+
threshold: options.durationRestThreshold,
|
|
17
|
+
fps,
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
getProgress: ({ fps, frame }) => {
|
|
21
|
+
return springWithInvalidArgumentRejection({
|
|
22
|
+
fps,
|
|
23
|
+
frame,
|
|
24
|
+
config: options.config,
|
|
25
|
+
durationInFrames: options.durationInFrames,
|
|
26
|
+
durationRestThreshold: options.durationRestThreshold,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
export type PresentationDirection = "entering" | "exiting";
|
|
3
|
+
export type TransitionTiming = {
|
|
4
|
+
getDurationInFrames: (options: {
|
|
5
|
+
fps: number;
|
|
6
|
+
}) => number;
|
|
7
|
+
getProgress: (options: {
|
|
8
|
+
frame: number;
|
|
9
|
+
fps: number;
|
|
10
|
+
}) => number;
|
|
11
|
+
};
|
|
12
|
+
export type TransitionSeriesTransitionProps<PresentationProps extends Record<string, unknown>> = {
|
|
13
|
+
timing: TransitionTiming;
|
|
14
|
+
presentation?: TransitionPresentation<PresentationProps>;
|
|
15
|
+
};
|
|
16
|
+
type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
|
|
17
|
+
export type TransitionPresentation<PresentationProps extends Record<string, unknown>> = {
|
|
18
|
+
component: LooseComponentType<TransitionPresentationComponentProps<PresentationProps>>;
|
|
19
|
+
props: PresentationProps;
|
|
20
|
+
};
|
|
21
|
+
export type TransitionPresentationComponentProps<PresentationProps extends Record<string, unknown>> = {
|
|
22
|
+
presentationProgress: number;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
presentationDirection: PresentationDirection;
|
|
25
|
+
passedProps: PresentationProps;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/validate.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@remotion/transitions",
|
|
3
|
+
"version": "4.0.53",
|
|
4
|
+
"description": "Transition presets for Remotion",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"main": "dist/cjs/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"author": "Jonny Burger",
|
|
10
|
+
"contributors": [],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"url": "https://github.com/remotion-dev/remotion"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"remotion": "4.0.53"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@jonny/eslint-config": "3.0.276",
|
|
23
|
+
"eslint": "8.42.0",
|
|
24
|
+
"prettier": "3.0.2",
|
|
25
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
26
|
+
"react": "18.0.0",
|
|
27
|
+
"react-dom": "18.0.0",
|
|
28
|
+
"vitest": "0.31.1",
|
|
29
|
+
"@types/react": "18.0.26",
|
|
30
|
+
"@types/react-dom": "18.0.11",
|
|
31
|
+
"@vitejs/plugin-react": "^2.0.0",
|
|
32
|
+
"rollup": "^2.70.1",
|
|
33
|
+
"@rollup/plugin-typescript": "^8.2.0",
|
|
34
|
+
"remotion": "4.0.53",
|
|
35
|
+
"@remotion/test-utils": "4.0.53"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": ">=16.8.0",
|
|
39
|
+
"react-dom": ">=16.8.0"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"remotion",
|
|
43
|
+
"transitions"
|
|
44
|
+
],
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"exports": {
|
|
49
|
+
".": {
|
|
50
|
+
"module": "./dist/index.js",
|
|
51
|
+
"import": "./dist/index.js",
|
|
52
|
+
"types": "./dist/index.d.ts",
|
|
53
|
+
"require": "./dist/cjs/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./fade": {
|
|
56
|
+
"module": "./dist/presentations/fade.js",
|
|
57
|
+
"import": "./dist/presentations/fade.js",
|
|
58
|
+
"require": "./dist/cjs/presentations/fade.js",
|
|
59
|
+
"types": "./dist/presentations/fade.d.ts"
|
|
60
|
+
},
|
|
61
|
+
"./slide": {
|
|
62
|
+
"module": "./dist/presentations/slide.js",
|
|
63
|
+
"import": "./dist/presentations/slide.js",
|
|
64
|
+
"require": "./dist/cjs/presentations/slide.js",
|
|
65
|
+
"types": "./dist/presentations/slide.d.ts"
|
|
66
|
+
},
|
|
67
|
+
"./wipe": {
|
|
68
|
+
"module": "./dist/presentations/wipe.js",
|
|
69
|
+
"import": "./dist/presentations/wipe.js",
|
|
70
|
+
"require": "./dist/cjs/presentations/wipe.js",
|
|
71
|
+
"types": "./dist/presentations/wipe.d.ts"
|
|
72
|
+
},
|
|
73
|
+
"./package.json": "./package.json"
|
|
74
|
+
},
|
|
75
|
+
"typesVersions": {
|
|
76
|
+
">=1.0": {
|
|
77
|
+
"wipe": [
|
|
78
|
+
"dist/presentations/wipe.d.ts"
|
|
79
|
+
],
|
|
80
|
+
"slide": [
|
|
81
|
+
"dist/presentations/slide.d.ts"
|
|
82
|
+
],
|
|
83
|
+
"fade": [
|
|
84
|
+
"dist/presentations/fade.d.ts"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"scripts": {
|
|
89
|
+
"lint": "eslint src --ext ts,tsx",
|
|
90
|
+
"watch": "tsc -w",
|
|
91
|
+
"build": "rollup --config rollup.config.js && tsc -d"
|
|
92
|
+
}
|
|
93
|
+
}
|