Skip to content

🎥 Make videos programmatically with React

nice

JonnyBurger0b56fd0804a3
diff --git a/packages/promo-pages/src/components/3DEngine/Outer.tsx b/packages/promo-pages/src/components/3DEngine/Outer.tsx
index 001aee782e..7dc071ca86 100644
--- a/packages/promo-pages/src/components/3DEngine/Outer.tsx
+++ b/packages/promo-pages/src/components/3DEngine/Outer.tsx
@@ -50,11 +50,14 @@ export const Outer: React.FC<{
transformationHovered,
);
- const depthFromClick = -clickTransform * 20;
+ const depthFromClick = clickTransform * 20;
const depthFromHover = interpolate(hoverTransform, [0, 1], [20, 30]);
- const depth = depthFromHover + depthFromClick;
+ const depth = depthFromHover;
- const frontFace = reduceMatrices([translateZ(-depth / 2), transformation]);
+ const frontFace = reduceMatrices([
+ translateZ(-depth / 2 + depthFromClick),
+ transformation,
+ ]);
const centerOriented = reduceMatrices([
translateX(-width / 2),
translateY(-height / 2),
@@ -71,6 +74,7 @@ export const Outer: React.FC<{
sideColor: 'black',
crispEdges: false,
depth,
+ pressInDepth: depthFromClick,
points: parsePath(path),
description: 'rect',
transformations: centerOriented,
diff --git a/packages/svg-3d-engine/src/extrude-element.ts b/packages/svg-3d-engine/src/extrude-element.ts
index d2da3b99a7..50ba2ccc73 100644
--- a/packages/svg-3d-engine/src/extrude-element.ts
+++ b/packages/svg-3d-engine/src/extrude-element.ts
@@ -55,6 +55,7 @@ const inverseInstruction = (
type ExtrudeElementOptions = {
depth: number;
+ pressInDepth: number;
sideColor: string;
points: Instruction[];
description?: string;
@@ -66,6 +67,7 @@ export const extrudeElement = ({
sideColor,
points,
crispEdges,
+ pressInDepth,
}: ExtrudeElementOptions): FaceType[] => {
const threeD = turnInto3D(points);
const instructions: FaceType = {
@@ -90,7 +92,7 @@ export const extrudeElement = ({
const movingOver: Vector4D = [
nextPoint[0],
nextPoint[1],
- nextPoint[2] - depth,
+ nextPoint[2] - depth + pressInDepth,
nextPoint[3],
];
@@ -98,7 +100,7 @@ export const extrudeElement = ({
inverseInstruction(nextInstruction, currentPoint),
0,
0,
- -depth,
+ -depth + pressInDepth,
);
const newInstructions: ThreeDReducedInstruction[] = [
{