@remotion/transitions 4.0.53 → 4.0.55

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/.prettierrc.js ADDED
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ singleQuote: true,
3
+ bracketSpacing: false,
4
+ useTabs: true,
5
+ overrides: [
6
+ {
7
+ files: ['*.yml'],
8
+ options: {
9
+ singleQuote: false,
10
+ },
11
+ },
12
+ ],
13
+ plugins: [require.resolve('prettier-plugin-organize-imports')],
14
+ };
@@ -84,8 +84,13 @@ const TransitionSeriesChildren = ({ children, }) => {
84
84
  });
85
85
  transitionOffsets -= duration;
86
86
  }
87
- const actualStartFrame = currentStartFrame + transitionOffsets;
87
+ let actualStartFrame = currentStartFrame + transitionOffsets;
88
88
  startFrame += durationInFramesProp + offset;
89
+ // Handle the case where the first item is a transition
90
+ if (actualStartFrame < 0) {
91
+ startFrame -= actualStartFrame;
92
+ actualStartFrame = 0;
93
+ }
89
94
  const inner = (_jsx(Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: child }));
90
95
  const nextProgress = next
91
96
  ? next.props.timing.getProgress({
@@ -0,0 +1,40 @@
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 Flip = ({ children, presentationDirection, presentationProgress, passedProps: { direction = 'from-left', perspective = 1000 }, }) => {
10
+ const style = react.useMemo(() => {
11
+ const startRotationEntering = direction === 'from-right' || direction === 'from-top' ? 180 : -180;
12
+ const endRotationEntering = direction === 'from-right' || direction === 'from-top' ? -180 : 180;
13
+ const rotation = presentationDirection === 'entering'
14
+ ? remotion.interpolate(presentationProgress, [0, 1], [startRotationEntering, 0])
15
+ : remotion.interpolate(presentationProgress, [0, 1], [0, endRotationEntering]);
16
+ const rotateProperty = direction === 'from-top' || direction === 'from-bottom'
17
+ ? 'rotateX'
18
+ : 'rotateY';
19
+ return {
20
+ width: '100%',
21
+ height: '100%',
22
+ transform: `${rotateProperty}(${rotation}deg)`,
23
+ backfaceVisibility: 'hidden',
24
+ WebkitBackfaceVisibility: 'hidden',
25
+ };
26
+ }, [direction, presentationDirection, presentationProgress]);
27
+ const outer = react.useMemo(() => {
28
+ return {
29
+ perspective,
30
+ // Make children also their backface hidden
31
+ transformStyle: 'preserve-3d',
32
+ };
33
+ }, [perspective]);
34
+ return (jsxRuntime.jsx(remotion.AbsoluteFill, { style: outer, children: jsxRuntime.jsx(remotion.AbsoluteFill, { style: style, children: children }) }));
35
+ };
36
+ const flip = (props) => {
37
+ return { component: Flip, props: props !== null && props !== void 0 ? props : {} };
38
+ };
39
+
40
+ exports.flip = flip;
package/dist/cjs/index.js CHANGED
@@ -213,8 +213,13 @@ const TransitionSeriesChildren = ({ children, }) => {
213
213
  });
214
214
  transitionOffsets -= duration;
215
215
  }
216
- const actualStartFrame = currentStartFrame + transitionOffsets;
216
+ let actualStartFrame = currentStartFrame + transitionOffsets;
217
217
  startFrame += durationInFramesProp + offset;
218
+ // Handle the case where the first item is a transition
219
+ if (actualStartFrame < 0) {
220
+ startFrame -= actualStartFrame;
221
+ actualStartFrame = 0;
222
+ }
218
223
  const inner = (jsxRuntime.jsx(remotion.Sequence, { from: Math.floor(actualStartFrame), durationInFrames: durationInFramesProp, ...passedProps, children: child }));
219
224
  const nextProgress = next
220
225
  ? next.props.timing.getProgress({
@@ -0,0 +1,8 @@
1
+ import type { TransitionPresentation } from '../types.js';
2
+ export type FlipDirection = 'from-left' | 'from-right' | 'from-top' | 'from-bottom';
3
+ type FlipPresentationProps = {
4
+ direction?: FlipDirection;
5
+ perspective?: number;
6
+ };
7
+ export declare const flip: (props?: FlipPresentationProps) => TransitionPresentation<FlipPresentationProps>;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { TransitionPresentation } from '../types.js';
2
+ export type FlipDirection = 'from-left' | 'from-right' | 'from-top' | 'from-bottom';
3
+ type FlipPresentationProps = {
4
+ direction?: FlipDirection;
5
+ perspective?: number;
6
+ };
7
+ export declare const flip: (props?: FlipPresentationProps) => TransitionPresentation<FlipPresentationProps>;
8
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { AbsoluteFill, interpolate } from 'remotion';
4
+ const Flip = ({ children, presentationDirection, presentationProgress, passedProps: { direction = 'from-left', perspective = 1000 }, }) => {
5
+ const style = useMemo(() => {
6
+ const startRotationEntering = direction === 'from-right' || direction === 'from-top' ? 180 : -180;
7
+ const endRotationEntering = direction === 'from-right' || direction === 'from-top' ? -180 : 180;
8
+ const rotation = presentationDirection === 'entering'
9
+ ? interpolate(presentationProgress, [0, 1], [startRotationEntering, 0])
10
+ : interpolate(presentationProgress, [0, 1], [0, endRotationEntering]);
11
+ const rotateProperty = direction === 'from-top' || direction === 'from-bottom'
12
+ ? 'rotateX'
13
+ : 'rotateY';
14
+ return {
15
+ width: '100%',
16
+ height: '100%',
17
+ transform: `${rotateProperty}(${rotation}deg)`,
18
+ backfaceVisibility: 'hidden',
19
+ WebkitBackfaceVisibility: 'hidden',
20
+ };
21
+ }, [direction, presentationDirection, presentationProgress]);
22
+ const outer = useMemo(() => {
23
+ return {
24
+ perspective,
25
+ // Make children also their backface hidden
26
+ transformStyle: 'preserve-3d',
27
+ };
28
+ }, [perspective]);
29
+ return (_jsx(AbsoluteFill, { style: outer, children: _jsx(AbsoluteFill, { style: style, children: children }) }));
30
+ };
31
+ export const flip = (props) => {
32
+ return { component: Flip, props: props !== null && props !== void 0 ? props : {} };
33
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/transitions",
3
- "version": "4.0.53",
3
+ "version": "4.0.55",
4
4
  "description": "Transition presets for Remotion",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -16,7 +16,7 @@
16
16
  "url": "https://github.com/remotion-dev/remotion/issues"
17
17
  },
18
18
  "dependencies": {
19
- "remotion": "4.0.53"
19
+ "remotion": "4.0.55"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@jonny/eslint-config": "3.0.276",
@@ -31,8 +31,8 @@
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.53",
35
- "@remotion/test-utils": "4.0.53"
34
+ "remotion": "4.0.55",
35
+ "@remotion/test-utils": "4.0.55"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": ">=16.8.0",
@@ -70,6 +70,12 @@
70
70
  "require": "./dist/cjs/presentations/wipe.js",
71
71
  "types": "./dist/presentations/wipe.d.ts"
72
72
  },
73
+ "./flip": {
74
+ "module": "./dist/presentations/flip.js",
75
+ "import": "./dist/presentations/flip.js",
76
+ "require": "./dist/cjs/presentations/flip.js",
77
+ "types": "./dist/presentations/flip.d.ts"
78
+ },
73
79
  "./package.json": "./package.json"
74
80
  },
75
81
  "typesVersions": {
@@ -80,6 +86,9 @@
80
86
  "slide": [
81
87
  "dist/presentations/slide.d.ts"
82
88
  ],
89
+ "flip": [
90
+ "dist/presentations/flip.d.ts"
91
+ ],
83
92
  "fade": [
84
93
  "dist/presentations/fade.d.ts"
85
94
  ]
package/rollup.config.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // rollup.config.js
2
2
  import typescript from '@rollup/plugin-typescript';
3
3
 
4
+ const presentations = ['slide', 'flip', 'wipe', 'fade'];
5
+
4
6
  export default [
5
7
  {
6
8
  input: 'src/index.ts',
@@ -20,58 +22,24 @@ export default [
20
22
  }),
21
23
  ],
22
24
  },
23
- {
24
- input: 'src/presentations/slide.tsx',
25
- output: [
26
- {
27
- file: 'dist/cjs/slide.js',
28
- format: 'cjs',
29
- sourcemap: false,
30
- },
31
- ],
32
- external: ['remotion', 'react', 'react/jsx-runtime'],
33
- plugins: [
34
- typescript({
35
- tsconfig: 'tsconfig-cjs.json',
36
- sourceMap: false,
37
- outputToFilesystem: true,
38
- }),
39
- ],
40
- },
41
- {
42
- input: 'src/presentations/fade.tsx',
43
- output: [
44
- {
45
- file: 'dist/cjs/fade.js',
46
- format: 'cjs',
47
- sourcemap: false,
48
- },
49
- ],
50
- external: ['remotion', 'react', 'react/jsx-runtime'],
51
- plugins: [
52
- typescript({
53
- tsconfig: 'tsconfig-cjs.json',
54
- sourceMap: false,
55
- outputToFilesystem: true,
56
- }),
57
- ],
58
- },
59
- {
60
- input: 'src/presentations/wipe.tsx',
61
- output: [
62
- {
63
- file: 'dist/cjs/wipe.js',
64
- format: 'cjs',
65
- sourcemap: false,
66
- },
67
- ],
68
- external: ['remotion', 'react', 'react/jsx-runtime'],
69
- plugins: [
70
- typescript({
71
- tsconfig: 'tsconfig-cjs.json',
72
- sourceMap: false,
73
- outputToFilesystem: true,
74
- }),
75
- ],
76
- },
25
+ ...presentations.map((p) => {
26
+ return {
27
+ input: `src/presentations/${p}.tsx`,
28
+ output: [
29
+ {
30
+ file: `dist/cjs/${p}.js`,
31
+ format: 'cjs',
32
+ sourcemap: false,
33
+ },
34
+ ],
35
+ external: ['remotion', 'react', 'react/jsx-runtime'],
36
+ plugins: [
37
+ typescript({
38
+ tsconfig: 'tsconfig-cjs.json',
39
+ sourceMap: false,
40
+ outputToFilesystem: true,
41
+ }),
42
+ ],
43
+ };
44
+ }),
77
45
  ];