@remotion/transitions 4.0.137 → 4.0.139

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/build.ts ADDED
@@ -0,0 +1,30 @@
1
+ const presentations = ['slide', 'flip', 'wipe', 'fade', 'clock-wipe'];
2
+ import {build} from 'bun';
3
+ import path from 'path';
4
+
5
+ const output = await build({
6
+ entrypoints: [
7
+ 'src/index.ts',
8
+ ...presentations.map((p) => `src/presentations/${p}.tsx`),
9
+ ],
10
+ external: [
11
+ 'remotion',
12
+ 'remotion/no-react',
13
+ 'react',
14
+ 'react/jsx-runtime',
15
+ 'react/jsx-runtime',
16
+ 'react/jsx-dev-runtime',
17
+ '@remotion/paths',
18
+ '@remotion/shapes',
19
+ ],
20
+ naming: '[name].mjs',
21
+ });
22
+
23
+ for (const file of output.outputs) {
24
+ const str = await file.text();
25
+ const newStr = str
26
+ .replace(/jsxDEV/g, 'jsx')
27
+ .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
28
+
29
+ Bun.write(path.join('dist', 'esm', file.path), newStr);
30
+ }
@@ -1,45 +1,65 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { translatePath } from '@remotion/paths';
3
- import { makePie } from '@remotion/shapes';
4
- import { useState, useMemo } from 'react';
5
- import { random, AbsoluteFill } from 'remotion';
6
-
7
- const ClockWipePresentation = ({ children, presentationDirection, presentationProgress, passedProps }) => {
8
- const finishedRadius = Math.sqrt(passedProps.width ** 2 + passedProps.height ** 2) / 2;
9
- const { path } = makePie({
10
- radius: finishedRadius,
11
- progress: presentationProgress,
12
- });
13
- const translatedPath = translatePath(path, -(finishedRadius * 2 - passedProps.width) / 2, -(finishedRadius * 2 - passedProps.height) / 2);
14
- const [clipId] = useState(() => String(random(null)));
15
- const style = useMemo(() => {
16
- return {
17
- width: '100%',
18
- height: '100%',
19
- clipPath: presentationDirection === 'exiting' ? undefined : `url(#${clipId})`,
20
- ...(presentationDirection === 'entering'
21
- ? passedProps.innerEnterStyle
22
- : passedProps.innerExitStyle),
23
- };
24
- }, [
25
- clipId,
26
- passedProps.innerEnterStyle,
27
- passedProps.innerExitStyle,
28
- presentationDirection,
29
- ]);
30
- const outerStyle = useMemo(() => {
31
- return presentationDirection === 'entering'
32
- ? passedProps.outerEnterStyle
33
- : passedProps.outerExitStyle;
34
- }, [
35
- passedProps.outerEnterStyle,
36
- passedProps.outerExitStyle,
37
- presentationDirection,
38
- ]);
39
- return (jsxs(AbsoluteFill, { style: outerStyle, children: [jsx(AbsoluteFill, { style: style, children: children }), presentationDirection === 'exiting' ? null : (jsx(AbsoluteFill, { children: jsx("svg", { children: jsx("defs", { children: jsx("clipPath", { id: clipId, children: jsx("path", { d: translatedPath, fill: "black" }) }) }) }) }))] }));
1
+ // src/presentations/clock-wipe.tsx
2
+ import {translatePath} from "@remotion/paths";
3
+ import {makePie} from "@remotion/shapes";
4
+ import {useMemo, useState} from "react";
5
+ import {AbsoluteFill, random} from "remotion";
6
+ import {
7
+ jsx
8
+ } from "react/jsx-runtime";
9
+ var ClockWipePresentation = ({ children, presentationDirection, presentationProgress, passedProps }) => {
10
+ const finishedRadius = Math.sqrt(passedProps.width ** 2 + passedProps.height ** 2) / 2;
11
+ const { path } = makePie({
12
+ radius: finishedRadius,
13
+ progress: presentationProgress
14
+ });
15
+ const translatedPath = translatePath(path, -(finishedRadius * 2 - passedProps.width) / 2, -(finishedRadius * 2 - passedProps.height) / 2);
16
+ const [clipId] = useState(() => String(random(null)));
17
+ const style = useMemo(() => {
18
+ return {
19
+ width: "100%",
20
+ height: "100%",
21
+ clipPath: presentationDirection === "exiting" ? undefined : `url(#${clipId})`,
22
+ ...presentationDirection === "entering" ? passedProps.innerEnterStyle : passedProps.innerExitStyle
23
+ };
24
+ }, [
25
+ clipId,
26
+ passedProps.innerEnterStyle,
27
+ passedProps.innerExitStyle,
28
+ presentationDirection
29
+ ]);
30
+ const outerStyle = useMemo(() => {
31
+ return presentationDirection === "entering" ? passedProps.outerEnterStyle : passedProps.outerExitStyle;
32
+ }, [
33
+ passedProps.outerEnterStyle,
34
+ passedProps.outerExitStyle,
35
+ presentationDirection
36
+ ]);
37
+ return jsx(AbsoluteFill, {
38
+ style: outerStyle,
39
+ children: [
40
+ jsx(AbsoluteFill, {
41
+ style,
42
+ children
43
+ }, undefined, false, undefined, this),
44
+ presentationDirection === "exiting" ? null : jsx(AbsoluteFill, {
45
+ children: jsx("svg", {
46
+ children: jsx("defs", {
47
+ children: jsx("clipPath", {
48
+ id: clipId,
49
+ children: jsx("path", {
50
+ d: translatedPath,
51
+ fill: "black"
52
+ }, undefined, false, undefined, this)
53
+ }, undefined, false, undefined, this)
54
+ }, undefined, false, undefined, this)
55
+ }, undefined, false, undefined, this)
56
+ }, undefined, false, undefined, this)
57
+ ]
58
+ }, undefined, true, undefined, this);
40
59
  };
41
- const clockWipe = (props) => {
42
- return { component: ClockWipePresentation, props: props !== null && props !== void 0 ? props : {} };
60
+ var clockWipe = (props) => {
61
+ return { component: ClockWipePresentation, props: props ?? {} };
62
+ };
63
+ export {
64
+ clockWipe
43
65
  };
44
-
45
- export { clockWipe };
package/dist/esm/fade.mjs CHANGED
@@ -1,30 +1,34 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { useMemo } from 'react';
3
- import { AbsoluteFill } from 'remotion';
4
-
5
- const FadePresentation = ({ children, presentationDirection, presentationProgress, passedProps }) => {
6
- const isEntering = presentationDirection === 'entering';
7
- const style = useMemo(() => {
8
- return {
9
- opacity: isEntering ? presentationProgress : 1,
10
- ...(presentationDirection === 'entering'
11
- ? passedProps.enterStyle
12
- : passedProps.exitStyle),
13
- };
14
- }, [
15
- isEntering,
16
- passedProps.enterStyle,
17
- passedProps.exitStyle,
18
- presentationDirection,
19
- presentationProgress,
20
- ]);
21
- return jsx(AbsoluteFill, { style: style, children: children });
22
- };
23
- const fade = (props) => {
1
+ // src/presentations/fade.tsx
2
+ import {useMemo} from "react";
3
+ import {AbsoluteFill} from "remotion";
4
+ import {
5
+ jsx
6
+ } from "react/jsx-runtime";
7
+ var FadePresentation = ({ children, presentationDirection, presentationProgress, passedProps }) => {
8
+ const isEntering = presentationDirection === "entering";
9
+ const style = useMemo(() => {
24
10
  return {
25
- component: FadePresentation,
26
- props: props !== null && props !== void 0 ? props : {},
11
+ opacity: isEntering ? presentationProgress : 1,
12
+ ...presentationDirection === "entering" ? passedProps.enterStyle : passedProps.exitStyle
27
13
  };
14
+ }, [
15
+ isEntering,
16
+ passedProps.enterStyle,
17
+ passedProps.exitStyle,
18
+ presentationDirection,
19
+ presentationProgress
20
+ ]);
21
+ return jsx(AbsoluteFill, {
22
+ style,
23
+ children
24
+ }, undefined, false, undefined, this);
25
+ };
26
+ var fade = (props) => {
27
+ return {
28
+ component: FadePresentation,
29
+ props: props ?? {}
30
+ };
31
+ };
32
+ export {
33
+ fade
28
34
  };
29
-
30
- export { fade };
package/dist/esm/flip.mjs CHANGED
@@ -1,48 +1,60 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { useMemo } from 'react';
3
- import { interpolate, AbsoluteFill } from 'remotion';
4
-
5
- const Flip = ({ children, presentationDirection, presentationProgress, passedProps: { direction = 'from-left', perspective = 1000, innerEnterStyle, innerExitStyle, outerEnterStyle, outerExitStyle, }, }) => {
6
- const style = useMemo(() => {
7
- const startRotationEntering = direction === 'from-right' || direction === 'from-top' ? 180 : -180;
8
- const endRotationEntering = direction === 'from-right' || direction === 'from-top' ? -180 : 180;
9
- const rotation = presentationDirection === 'entering'
10
- ? interpolate(presentationProgress, [0, 1], [startRotationEntering, 0])
11
- : interpolate(presentationProgress, [0, 1], [0, endRotationEntering]);
12
- const rotateProperty = direction === 'from-top' || direction === 'from-bottom'
13
- ? 'rotateX'
14
- : 'rotateY';
15
- return {
16
- width: '100%',
17
- height: '100%',
18
- transform: `${rotateProperty}(${rotation}deg)`,
19
- backfaceVisibility: 'hidden',
20
- WebkitBackfaceVisibility: 'hidden',
21
- ...(presentationDirection === 'entering'
22
- ? innerEnterStyle
23
- : innerExitStyle),
24
- };
25
- }, [
26
- direction,
27
- innerEnterStyle,
28
- innerExitStyle,
29
- presentationDirection,
30
- presentationProgress,
31
- ]);
32
- const outer = useMemo(() => {
33
- return {
34
- perspective,
35
- // Make children also their backface hidden
36
- transformStyle: 'preserve-3d',
37
- ...(presentationDirection === 'entering'
38
- ? outerEnterStyle
39
- : outerExitStyle),
40
- };
41
- }, [outerEnterStyle, outerExitStyle, perspective, presentationDirection]);
42
- return (jsx(AbsoluteFill, { style: outer, children: jsx(AbsoluteFill, { style: style, children: children }) }));
1
+ // src/presentations/flip.tsx
2
+ import {useMemo} from "react";
3
+ import {AbsoluteFill, interpolate} from "remotion";
4
+ import {
5
+ jsx
6
+ } from "react/jsx-runtime";
7
+ var Flip = ({
8
+ children,
9
+ presentationDirection,
10
+ presentationProgress,
11
+ passedProps: {
12
+ direction = "from-left",
13
+ perspective = 1000,
14
+ innerEnterStyle,
15
+ innerExitStyle,
16
+ outerEnterStyle,
17
+ outerExitStyle
18
+ }
19
+ }) => {
20
+ const style = useMemo(() => {
21
+ const startRotationEntering = direction === "from-right" || direction === "from-top" ? 180 : -180;
22
+ const endRotationEntering = direction === "from-right" || direction === "from-top" ? -180 : 180;
23
+ const rotation = presentationDirection === "entering" ? interpolate(presentationProgress, [0, 1], [startRotationEntering, 0]) : interpolate(presentationProgress, [0, 1], [0, endRotationEntering]);
24
+ const rotateProperty = direction === "from-top" || direction === "from-bottom" ? "rotateX" : "rotateY";
25
+ return {
26
+ width: "100%",
27
+ height: "100%",
28
+ transform: `${rotateProperty}(${rotation}deg)`,
29
+ backfaceVisibility: "hidden",
30
+ WebkitBackfaceVisibility: "hidden",
31
+ ...presentationDirection === "entering" ? innerEnterStyle : innerExitStyle
32
+ };
33
+ }, [
34
+ direction,
35
+ innerEnterStyle,
36
+ innerExitStyle,
37
+ presentationDirection,
38
+ presentationProgress
39
+ ]);
40
+ const outer = useMemo(() => {
41
+ return {
42
+ perspective,
43
+ transformStyle: "preserve-3d",
44
+ ...presentationDirection === "entering" ? outerEnterStyle : outerExitStyle
45
+ };
46
+ }, [outerEnterStyle, outerExitStyle, perspective, presentationDirection]);
47
+ return jsx(AbsoluteFill, {
48
+ style: outer,
49
+ children: jsx(AbsoluteFill, {
50
+ style,
51
+ children
52
+ }, undefined, false, undefined, this)
53
+ }, undefined, false, undefined, this);
43
54
  };
44
- const flip = (props) => {
45
- return { component: Flip, props: props !== null && props !== void 0 ? props : {} };
55
+ var flip = (props) => {
56
+ return { component: Flip, props: props ?? {} };
57
+ };
58
+ export {
59
+ flip
46
60
  };
47
-
48
- export { flip };