@remotion/transitions 4.0.315 → 4.0.316

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/bundle.ts CHANGED
@@ -5,7 +5,7 @@ if (process.env.NODE_ENV !== 'production') {
5
5
  throw new Error('This script must be run using NODE_ENV=production');
6
6
  }
7
7
 
8
- const presentations = ['slide', 'flip', 'wipe', 'fade', 'clock-wipe', 'none'];
8
+ const presentations = ['slide', 'flip', 'wipe', 'fade', 'clock-wipe', 'none', 'iris'];
9
9
 
10
10
  const output = await build({
11
11
  entrypoints: [
@@ -0,0 +1,64 @@
1
+ // src/presentations/iris.tsx
2
+ import { translatePath } from "@remotion/paths";
3
+ import { makeCircle } from "@remotion/shapes";
4
+ import { useMemo, useState } from "react";
5
+ import { AbsoluteFill, random } from "remotion";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var IrisPresentation = ({ children, presentationDirection, presentationProgress, passedProps }) => {
8
+ const maxRadius = Math.sqrt(passedProps.width ** 2 + passedProps.height ** 2) / 2;
9
+ const minRadius = 0;
10
+ const currentRadius = presentationDirection === "entering" ? minRadius + (maxRadius - minRadius) * presentationProgress : maxRadius - (maxRadius - minRadius) * presentationProgress;
11
+ const { path } = makeCircle({
12
+ radius: currentRadius
13
+ });
14
+ const translatedPath = translatePath(path, passedProps.width / 2 - currentRadius, passedProps.height / 2 - currentRadius);
15
+ const [clipId] = useState(() => String(random(null)));
16
+ const style = useMemo(() => {
17
+ return {
18
+ width: "100%",
19
+ height: "100%",
20
+ clipPath: presentationDirection === "exiting" ? undefined : `url(#${clipId})`,
21
+ ...presentationDirection === "entering" ? passedProps.innerEnterStyle : passedProps.innerExitStyle
22
+ };
23
+ }, [
24
+ clipId,
25
+ passedProps.innerEnterStyle,
26
+ passedProps.innerExitStyle,
27
+ presentationDirection
28
+ ]);
29
+ const outerStyle = useMemo(() => {
30
+ return presentationDirection === "entering" ? passedProps.outerEnterStyle : passedProps.outerExitStyle;
31
+ }, [
32
+ passedProps.outerEnterStyle,
33
+ passedProps.outerExitStyle,
34
+ presentationDirection
35
+ ]);
36
+ return /* @__PURE__ */ jsxs(AbsoluteFill, {
37
+ style: outerStyle,
38
+ children: [
39
+ /* @__PURE__ */ jsx(AbsoluteFill, {
40
+ style,
41
+ children
42
+ }),
43
+ presentationDirection === "exiting" ? null : /* @__PURE__ */ jsx(AbsoluteFill, {
44
+ children: /* @__PURE__ */ jsx("svg", {
45
+ children: /* @__PURE__ */ jsx("defs", {
46
+ children: /* @__PURE__ */ jsx("clipPath", {
47
+ id: clipId,
48
+ children: /* @__PURE__ */ jsx("path", {
49
+ d: translatedPath,
50
+ fill: "black"
51
+ })
52
+ })
53
+ })
54
+ })
55
+ })
56
+ ]
57
+ });
58
+ };
59
+ var iris = (props) => {
60
+ return { component: IrisPresentation, props: props ?? {} };
61
+ };
62
+ export {
63
+ iris
64
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { TransitionPresentation } from '../types.js';
3
+ export type IrisProps = {
4
+ width: number;
5
+ height: number;
6
+ outerEnterStyle?: React.CSSProperties;
7
+ outerExitStyle?: React.CSSProperties;
8
+ innerEnterStyle?: React.CSSProperties;
9
+ innerExitStyle?: React.CSSProperties;
10
+ };
11
+ export declare const iris: (props: IrisProps) => TransitionPresentation<IrisProps>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.iris = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const paths_1 = require("@remotion/paths");
6
+ const shapes_1 = require("@remotion/shapes");
7
+ const react_1 = require("react");
8
+ const remotion_1 = require("remotion");
9
+ const IrisPresentation = ({ children, presentationDirection, presentationProgress, passedProps }) => {
10
+ // Calculate the radius needed to cover the entire viewport
11
+ const maxRadius = Math.sqrt(passedProps.width ** 2 + passedProps.height ** 2) / 2;
12
+ // For iris, we want to start small and grow large (entering)
13
+ // or start large and shrink small (exiting)
14
+ const minRadius = 0;
15
+ const currentRadius = presentationDirection === 'entering'
16
+ ? minRadius + (maxRadius - minRadius) * presentationProgress
17
+ : maxRadius - (maxRadius - minRadius) * presentationProgress;
18
+ const { path } = (0, shapes_1.makeCircle)({
19
+ radius: currentRadius,
20
+ });
21
+ // Center the circle in the viewport
22
+ const translatedPath = (0, paths_1.translatePath)(path, passedProps.width / 2 - currentRadius, passedProps.height / 2 - currentRadius);
23
+ const [clipId] = (0, react_1.useState)(() => String((0, remotion_1.random)(null)));
24
+ const style = (0, react_1.useMemo)(() => {
25
+ return {
26
+ width: '100%',
27
+ height: '100%',
28
+ clipPath: presentationDirection === 'exiting' ? undefined : `url(#${clipId})`,
29
+ ...(presentationDirection === 'entering'
30
+ ? passedProps.innerEnterStyle
31
+ : passedProps.innerExitStyle),
32
+ };
33
+ }, [
34
+ clipId,
35
+ passedProps.innerEnterStyle,
36
+ passedProps.innerExitStyle,
37
+ presentationDirection,
38
+ ]);
39
+ const outerStyle = (0, react_1.useMemo)(() => {
40
+ return presentationDirection === 'entering'
41
+ ? passedProps.outerEnterStyle
42
+ : passedProps.outerExitStyle;
43
+ }, [
44
+ passedProps.outerEnterStyle,
45
+ passedProps.outerExitStyle,
46
+ presentationDirection,
47
+ ]);
48
+ return ((0, jsx_runtime_1.jsxs)(remotion_1.AbsoluteFill, { style: outerStyle, children: [(0, jsx_runtime_1.jsx)(remotion_1.AbsoluteFill, { style: style, children: children }), presentationDirection === 'exiting' ? null : ((0, jsx_runtime_1.jsx)(remotion_1.AbsoluteFill, { children: (0, jsx_runtime_1.jsx)("svg", { children: (0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: clipId, children: (0, jsx_runtime_1.jsx)("path", { d: translatedPath, fill: "black" }) }) }) }) }))] }));
49
+ };
50
+ /*
51
+ * @description Creates an iris transition that uses a circular mask starting from the center to reveal the underlying scene.
52
+ * @see [Documentation](https://www.remotion.dev/docs/transitions/presentations/iris)
53
+ */
54
+ const iris = (props) => {
55
+ return { component: IrisPresentation, props: props !== null && props !== void 0 ? props : {} };
56
+ };
57
+ exports.iris = iris;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/transitions"
4
4
  },
5
5
  "name": "@remotion/transitions",
6
- "version": "4.0.315",
6
+ "version": "4.0.316",
7
7
  "description": "Library for creating transitions in Remotion",
8
8
  "sideEffects": false,
9
9
  "main": "dist/esm/index.mjs",
@@ -16,19 +16,19 @@
16
16
  "url": "https://github.com/remotion-dev/remotion/issues"
17
17
  },
18
18
  "dependencies": {
19
- "remotion": "4.0.315",
20
- "@remotion/shapes": "4.0.315",
21
- "@remotion/paths": "4.0.315"
19
+ "remotion": "4.0.316",
20
+ "@remotion/paths": "4.0.316",
21
+ "@remotion/shapes": "4.0.316"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@happy-dom/global-registrator": "14.5.1",
25
25
  "react": "19.0.0",
26
26
  "react-dom": "19.0.0",
27
27
  "eslint": "9.19.0",
28
- "remotion": "4.0.315",
29
- "@remotion/player": "4.0.315",
30
- "@remotion/test-utils": "4.0.315",
31
- "@remotion/eslint-config-internal": "4.0.315"
28
+ "remotion": "4.0.316",
29
+ "@remotion/test-utils": "4.0.316",
30
+ "@remotion/eslint-config-internal": "4.0.316",
31
+ "@remotion/player": "4.0.316"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": ">=16.8.0",
@@ -84,6 +84,12 @@
84
84
  "import": "./dist/esm/none.mjs",
85
85
  "require": "./dist/presentations/none.js"
86
86
  },
87
+ "./iris": {
88
+ "types": "./dist/presentations/iris.d.ts",
89
+ "module": "./dist/esm/iris.mjs",
90
+ "import": "./dist/esm/iris.mjs",
91
+ "require": "./dist/presentations/iris.js"
92
+ },
87
93
  "./package.json": "./package.json"
88
94
  },
89
95
  "typesVersions": {
@@ -105,6 +111,9 @@
105
111
  ],
106
112
  "clock-wipe": [
107
113
  "dist/presentations/clock-wipe.d.ts"
114
+ ],
115
+ "iris": [
116
+ "dist/presentations/iris.d.ts"
108
117
  ]
109
118
  }
110
119
  },