Skip to content

🎥 Make videos programmatically with React

use crispedges

MehmetAdemi817403d0cabd
diff --git a/packages/docs/src/components/DoMoreHero/Face.tsx b/packages/docs/src/components/DoMoreHero/Face.tsx
index fa6de145b9..04a6165c7b 100644
--- a/packages/docs/src/components/DoMoreHero/Face.tsx
+++ b/packages/docs/src/components/DoMoreHero/Face.tsx
@@ -14,6 +14,7 @@ export const Face: React.FC<
color: string;
strokeColor: string;
strokeWidth: number;
+ crispEdges: boolean;
} & FaceSVGProps
> = ({
color,
@@ -22,6 +23,7 @@ export const Face: React.FC<
strokeWidth,
strokeMiterlimit,
strokeLinecap,
+ crispEdges,
}) => {
const [id] = useState(() => random(null).toString().replace(".", ""));
const d = threeDIntoSvgPath(points);
@@ -33,7 +35,7 @@ export const Face: React.FC<
<mask id={id}>
<path
strokeLinecap={strokeLinecap}
- shapeRendering="crispEdges"
+ shapeRendering={crispEdges ? "crispEdges" : undefined}
strokeMiterlimit={strokeMiterlimit}
strokeWidth={strokeWidth}
d={d}
@@ -48,7 +50,7 @@ export const Face: React.FC<
mask={strokeWidth ? `url(#${id})` : undefined}
stroke={strokeColor}
strokeMiterlimit={strokeMiterlimit}
- shapeRendering="crispEdges"
+ shapeRendering={crispEdges ? "crispEdges" : undefined}
strokeLinecap={strokeLinecap}
strokeWidth={strokeWidth}
/>
diff --git a/packages/docs/src/components/DoMoreHero/Faces.tsx b/packages/docs/src/components/DoMoreHero/Faces.tsx
index f73444e14a..70e5aee0f1 100644
--- a/packages/docs/src/components/DoMoreHero/Faces.tsx
+++ b/packages/docs/src/components/DoMoreHero/Faces.tsx
@@ -31,7 +31,10 @@ export const Faces: React.FC<
// eslint-disable-next-line react/no-array-index-key
<React.Fragment key={i}>
{sortedFaces.map(
- ({ points, color, strokeWidth, strokeColor }, idx) => {
+ (
+ { points, color, strokeWidth, strokeColor, crispEdges },
+ idx
+ ) => {
return (
<Face
// eslint-disable-next-line react/no-array-index-key
@@ -40,6 +43,7 @@ export const Faces: React.FC<
color={color}
points={points}
strokeWidth={strokeWidth}
+ crispEdges={crispEdges}
{...svgProps}
/>
);
diff --git a/packages/docs/src/components/DoMoreHero/join-inbetween-tiles.ts b/packages/docs/src/components/DoMoreHero/join-inbetween-tiles.ts
index f78ccba842..840e04506a 100644
--- a/packages/docs/src/components/DoMoreHero/join-inbetween-tiles.ts
+++ b/packages/docs/src/components/DoMoreHero/join-inbetween-tiles.ts
@@ -48,6 +48,7 @@ export const extrudeElement = ({
strokeColor,
color: "black",
description,
+ crispEdges: false,
};
const unscaledBackFace = transformFace(instructions, [translateZ(depth / 2)]);
@@ -106,6 +107,7 @@ export const extrudeElement = ({
strokeWidth: 0,
strokeColor: "black",
description: description + "inbetween",
+ crispEdges: true,
};
});
diff --git a/packages/docs/src/components/DoMoreHero/map-face.ts b/packages/docs/src/components/DoMoreHero/map-face.ts
index 72dfe59c4f..bb8726165d 100644
--- a/packages/docs/src/components/DoMoreHero/map-face.ts
+++ b/packages/docs/src/components/DoMoreHero/map-face.ts
@@ -13,6 +13,7 @@ export type FaceType = {
strokeWidth: number;
strokeColor: string;
description: string;
+ crispEdges: boolean;
};
export const translateSvgInstruction = (
@@ -147,12 +148,14 @@ export const makeFace = ({
strokeColor,
fill,
description,
+ crispEdges,
}: {
points: string | ThreeDReducedInstruction[];
strokeWidth: number;
strokeColor: string;
fill: string;
description: string;
+ crispEdges: boolean;
}): FaceType => {
const centerPoint: Vector4D = [0, 0, 0, 1];
@@ -163,5 +166,6 @@ export const makeFace = ({
strokeWidth,
strokeColor,
description,
+ crispEdges,
};
};