-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathComposition.tsx
More file actions
50 lines (41 loc) · 1.09 KB
/
Composition.tsx
File metadata and controls
50 lines (41 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import {getBoundingBox, parsePath, resetPath} from '@remotion/paths';
import {useCurrentFrame} from 'remotion';
import {transformElement} from './element';
import {Faces} from './Faces';
import {getText, useFont} from './get-char';
import {extrudeElement} from './join-inbetween-tiles';
import {rotateY} from './matrix';
export const MyComposition = () => {
const frame = useCurrentFrame();
const font = useFont();
if (!font) {
return null;
}
const text = getText({font, text: '4'});
const scaled = resetPath(text.path);
const bBox = getBoundingBox(scaled);
const width = bBox.x2 - bBox.x1;
const height = bBox.y2 - bBox.y1;
const depth = 150;
const inbetweenFaces = extrudeElement({
points: parsePath(scaled),
depth,
sideColor: 'green',
frontFaceColor: 'red',
backFaceColor: 'blue',
strokeWidth: 10,
description: 'text',
});
const rotatedFaces = transformElement(inbetweenFaces, [rotateY(frame / 100)]);
return (
<svg
viewBox="-800 -800 1600 1600"
style={{
width: '100%',
backgroundColor: 'white',
}}
>
<Faces elements={[rotatedFaces]} />
</svg>
);
};