Skip to content

🎥 Make videos programmatically with React

Docs: Use text in cylinder effect preview

Jonny Burgere0eae183c430
diff --git a/packages/docs/components/effects-demos/registry.ts b/packages/docs/components/effects-demos/registry.ts
index e29180c072..d6b18c8a97 100644
--- a/packages/docs/components/effects-demos/registry.ts
+++ b/packages/docs/components/effects-demos/registry.ts
@@ -195,6 +195,8 @@ const shrinkwrapDemoSchema = {
},
} as const;
+const cylinderDemoSchema = cylinder().definition.schema;
+
export const effectsDemos: EffectsDemoType[] = [
{
...defaults,
@@ -202,7 +204,25 @@ export const effectsDemos: EffectsDemoType[] = [
effectName: 'cylinder',
effectImportPath: '@remotion/effects/cylinder',
comp: EffectsCylinderPreview,
- schema: cylinder().definition.schema,
+ schema: {
+ ...cylinderDemoSchema,
+ radius: {
+ ...cylinderDemoSchema.radius,
+ type: 'number',
+ default: 340,
+ hiddenFromList: false,
+ },
+ rotationX: {
+ ...cylinderDemoSchema.rotationX,
+ type: 'rotation-degrees',
+ default: 52,
+ },
+ rotationZ: {
+ ...cylinderDemoSchema.rotationZ,
+ type: 'rotation-degrees',
+ default: -18,
+ },
+ },
},
{
...defaults,
diff --git a/packages/docs/components/effects/effects-cylinder-preview.tsx b/packages/docs/components/effects/effects-cylinder-preview.tsx
index d8c463ba44..26900fe05f 100644
--- a/packages/docs/components/effects/effects-cylinder-preview.tsx
+++ b/packages/docs/components/effects/effects-cylinder-preview.tsx
@@ -1,7 +1,29 @@
import {cylinder, type CylinderRender} from '@remotion/effects/cylinder';
import React from 'react';
-import {CanvasImage} from 'remotion';
-import {EFFECTS_PREVIEW_IMAGE_SRC} from './effects-preview-image';
+import {AbsoluteFill, CanvasImage, staticFile} from 'remotion';
+
+export const CYLINDER_TEXT_IMAGE_SRC = 'img/effects-cylinder-text.png';
+
+export const CylinderTextSource: React.FC = () => {
+ return (
+ <AbsoluteFill style={{justifyContent: 'center'}}>
+ <div
+ style={{
+ display: 'flex',
+ color: '#182033',
+ fontFamily: 'Arial, Helvetica, sans-serif',
+ fontSize: 80,
+ fontWeight: 700,
+ lineHeight: 1,
+ whiteSpace: 'nowrap',
+ }}
+ >
+ <div style={{flex: 1, textAlign: 'center'}}>MAKE IT MOVE •</div>
+ <div style={{flex: 1, textAlign: 'center'}}>MAKE IT MOVE •</div>
+ </div>
+ </AbsoluteFill>
+ );
+};
export const EffectsCylinderPreview: React.FC<{
readonly radius: number;
@@ -14,12 +36,14 @@ export const EffectsCylinderPreview: React.FC<{
readonly shading: number;
}> = (params) => {
return (
- <CanvasImage
- src={EFFECTS_PREVIEW_IMAGE_SRC}
- width={1280}
- height={720}
- fit="cover"
- effects={[cylinder(params)]}
- />
+ <AbsoluteFill style={{backgroundColor: '#eef1f4'}}>
+ <CanvasImage
+ src={staticFile(CYLINDER_TEXT_IMAGE_SRC)}
+ width={1280}
+ height={720}
+ fit="cover"
+ effects={[cylinder(params)]}
+ />
+ </AbsoluteFill>
);
};
diff --git a/packages/docs/src/remotion/Root.tsx b/packages/docs/src/remotion/Root.tsx
index 1c4e688c6e..b117558ea0 100644
--- a/packages/docs/src/remotion/Root.tsx
+++ b/packages/docs/src/remotion/Root.tsx
@@ -15,7 +15,10 @@ import {EffectsColorKeyPreview} from '../../components/effects/effects-color-key
import {EffectsContourLinesPreview} from '../../components/effects/effects-contour-lines-preview';
import {EffectsContrastPreview} from '../../components/effects/effects-contrast-preview';
import {EffectsCornerPinPreview} from '../../components/effects/effects-corner-pin-preview';
-import {EffectsCylinderPreview} from '../../components/effects/effects-cylinder-preview';
+import {
+ CylinderTextSource,
+ EffectsCylinderPreview,
+} from '../../components/effects/effects-cylinder-preview';
import {EffectsDotGridPreview} from '../../components/effects/effects-dot-grid-preview';
import {EffectsDropShadowPreview} from '../../components/effects/effects-drop-shadow-preview';
import {EffectsDuotonePreview} from '../../components/effects/effects-duotone-preview';
@@ -233,17 +236,23 @@ export const RemotionRoot: React.FC = () => {
fps={30}
durationInFrames={180}
/>
+ <Still
+ id="effects-cylinder-text"
+ component={CylinderTextSource}
+ width={1280}
+ height={720}
+ />
<Still
id="effects-cylinder-preview"
component={EffectsCylinderPreview}
width={1280}
height={720}
defaultProps={{
- radius: 370,
+ radius: 340,
rotation: 30,
- rotationX: 18,
+ rotationX: 52,
rotationY: 0,
- rotationZ: -15,
+ rotationZ: -18,
position: [0.5, 0.5],
render: 'both',
shading: 0.35,
diff --git a/packages/docs/static/img/effects-cylinder-preview.png b/packages/docs/static/img/effects-cylinder-preview.png
index 53f5199728..c4b674d40a 100644
Binary files a/packages/docs/static/img/effects-cylinder-preview.png and b/packages/docs/static/img/effects-cylinder-preview.png differ
diff --git a/packages/docs/static/img/effects-cylinder-text.png b/packages/docs/static/img/effects-cylinder-text.png
new file mode 100644
index 0000000000..84ecf60c27
Binary files /dev/null and b/packages/docs/static/img/effects-cylinder-text.png differ