Skip to content

The open alternative to Salesforce, designed for AI.

Isolate illustrations from sections to style them independently. (#19447)

Abdullah.83917f0dca1b
diff --git a/packages/twenty-website-new/public/illustrations/home/helped/three.glb b/packages/twenty-website-new/public/illustrations/home/helped/money.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/home/helped/three.glb
rename to packages/twenty-website-new/public/illustrations/home/helped/money.glb
diff --git a/packages/twenty-website-new/public/illustrations/home/helped/two.glb b/packages/twenty-website-new/public/illustrations/home/helped/spaceship.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/home/helped/two.glb
rename to packages/twenty-website-new/public/illustrations/home/helped/spaceship.glb
diff --git a/packages/twenty-website-new/public/illustrations/home/helped/one.glb b/packages/twenty-website-new/public/illustrations/home/helped/target.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/home/helped/one.glb
rename to packages/twenty-website-new/public/illustrations/home/helped/target.glb
diff --git a/packages/twenty-website-new/public/illustrations/home/testimonials/testimonials.glb b/packages/twenty-website-new/public/illustrations/home/testimonials/hourglass.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/home/testimonials/testimonials.glb
rename to packages/twenty-website-new/public/illustrations/home/testimonials/hourglass.glb
diff --git a/packages/twenty-website-new/public/illustrations/home/three-cards-illustration/one.glb b/packages/twenty-website-new/public/illustrations/home/three-cards/diamond.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/home/three-cards-illustration/one.glb
rename to packages/twenty-website-new/public/illustrations/home/three-cards/diamond.glb
diff --git a/packages/twenty-website-new/public/illustrations/home/three-cards-illustration/two.glb b/packages/twenty-website-new/public/illustrations/home/three-cards/flash.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/home/three-cards-illustration/two.glb
rename to packages/twenty-website-new/public/illustrations/home/three-cards/flash.glb
diff --git a/packages/twenty-website-new/public/illustrations/home/three-cards-illustration/three.glb b/packages/twenty-website-new/public/illustrations/home/three-cards/lock.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/home/three-cards-illustration/three.glb
rename to packages/twenty-website-new/public/illustrations/home/three-cards/lock.glb
diff --git a/packages/twenty-website-new/public/illustrations/partner/testimonials/testimonials.glb b/packages/twenty-website-new/public/illustrations/partner/testimonials/quote.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/partner/testimonials/testimonials.glb
rename to packages/twenty-website-new/public/illustrations/partner/testimonials/quote.glb
diff --git a/packages/twenty-website-new/public/illustrations/partner/three-cards-illustration/two.glb b/packages/twenty-website-new/public/illustrations/partner/three-cards/connect.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/partner/three-cards-illustration/two.glb
rename to packages/twenty-website-new/public/illustrations/partner/three-cards/connect.glb
diff --git a/packages/twenty-website-new/public/illustrations/partner/three-cards-illustration/three.glb b/packages/twenty-website-new/public/illustrations/partner/three-cards/grow.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/partner/three-cards-illustration/three.glb
rename to packages/twenty-website-new/public/illustrations/partner/three-cards/grow.glb
diff --git a/packages/twenty-website-new/public/illustrations/partner/three-cards-illustration/one.glb b/packages/twenty-website-new/public/illustrations/partner/three-cards/programming.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/partner/three-cards-illustration/one.glb
rename to packages/twenty-website-new/public/illustrations/partner/three-cards/programming.glb
diff --git a/packages/twenty-website-new/public/illustrations/product/three-cards-illustration/two.glb b/packages/twenty-website-new/public/illustrations/product/three-cards/eye.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/product/three-cards-illustration/two.glb
rename to packages/twenty-website-new/public/illustrations/product/three-cards/eye.glb
diff --git a/packages/twenty-website-new/public/illustrations/product/three-cards-illustration/three.glb b/packages/twenty-website-new/public/illustrations/product/three-cards/single-screen.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/product/three-cards-illustration/three.glb
rename to packages/twenty-website-new/public/illustrations/product/three-cards/single-screen.glb
diff --git a/packages/twenty-website-new/public/illustrations/product/three-cards-illustration/one.glb b/packages/twenty-website-new/public/illustrations/product/three-cards/speed.glb
similarity index 100%
rename from packages/twenty-website-new/public/illustrations/product/three-cards-illustration/one.glb
rename to packages/twenty-website-new/public/illustrations/product/three-cards/speed.glb
diff --git a/packages/twenty-website-new/src/app/(home)/_constants/helped.ts b/packages/twenty-website-new/src/app/(home)/_constants/helped.ts
index 489ea830894..5b57577c902 100644
--- a/packages/twenty-website-new/src/app/(home)/_constants/helped.ts
+++ b/packages/twenty-website-new/src/app/(home)/_constants/helped.ts
@@ -24,11 +24,7 @@ export const HELPED_DATA: HelpedDataType = {
body: {
text: 'Realytics built lead scoring into their CRM and increased qualified outbound by 40%.',
},
- illustration: {
- src: '/illustrations/home/helped/one.glb',
- title: '',
- color: '#DE8CF6',
- },
+ illustration: 'target',
},
{
icon: 'beagle',
@@ -36,11 +32,7 @@ export const HELPED_DATA: HelpedDataType = {
body: {
text: 'Beagle launched a custom onboarding pipeline and shortened their sales cycle by 30%.',
},
- illustration: {
- src: '/illustrations/home/helped/two.glb',
- title: '',
- color: '#89FC9A',
- },
+ illustration: 'spaceship',
},
{
@@ -49,11 +41,7 @@ export const HELPED_DATA: HelpedDataType = {
body: {
text: 'Evergreen unified sales and CS workflows, boosting expansion revenue by 25%.',
},
- illustration: {
- src: '/illustrations/home/helped/three.glb',
- title: '',
- color: '#E4E58A',
- },
+ illustration: 'money',
},
],
};
diff --git a/packages/twenty-website-new/src/app/(home)/_constants/three-cards-illustration.ts b/packages/twenty-website-new/src/app/(home)/_constants/three-cards-illustration.ts
index bc820826c0b..4dbd3b4427b 100644
--- a/packages/twenty-website-new/src/app/(home)/_constants/three-cards-illustration.ts
+++ b/packages/twenty-website-new/src/app/(home)/_constants/three-cards-illustration.ts
@@ -22,10 +22,7 @@ export const THREE_CARDS_ILLUSTRATION_DATA: ThreeCardsIllustrationDataType = {
role: { text: 'Head of Engineering' },
company: { text: 'Mid-Market Fintech' },
},
- illustration: {
- src: '/illustrations/home/three-cards-illustration/one.glb',
- title: 'Production grade illustration',
- },
+ illustration: 'diamond',
},
{
heading: { text: 'AI for rapid iterations', fontFamily: 'sans' },
@@ -37,10 +34,7 @@ export const THREE_CARDS_ILLUSTRATION_DATA: ThreeCardsIllustrationDataType = {
role: { text: 'Head of Engineering' },
company: { text: 'Mid-Market Fintech' },
},
- illustration: {
- src: '/illustrations/home/three-cards-illustration/two.glb',
- title: 'Rapid iteration illustration',
- },
+ illustration: 'flash',
},
{
heading: { text: 'Control without drag', fontFamily: 'sans' },
@@ -52,10 +46,7 @@ export const THREE_CARDS_ILLUSTRATION_DATA: ThreeCardsIllustrationDataType = {
role: { text: 'Head of Engineering' },
company: { text: 'Mid-Market Fintech' },
},
- illustration: {
- src: '/illustrations/home/three-cards-illustration/three.glb',
- title: 'Control illustration',
- },
+ illustration: 'lock',
},
],
};
diff --git a/packages/twenty-website-new/src/app/_constants/faq.ts b/packages/twenty-website-new/src/app/_constants/faq.ts
index ede26ad4076..aa0a339b3a6 100644
--- a/packages/twenty-website-new/src/app/_constants/faq.ts
+++ b/packages/twenty-website-new/src/app/_constants/faq.ts
@@ -1,10 +1,7 @@
import type { FaqDataType } from '@/sections/Faq/types';
export const FAQ_DATA: FaqDataType = {
- illustration: {
- src: '/illustrations/common/faq/faq.glb',
- title: 'FAQ illustration',
- },
+ illustration: 'faqBackground',
eyebrow: {
heading: {
text: 'Any Questions?',
diff --git a/packages/twenty-website-new/src/app/_constants/footer.ts b/packages/twenty-website-new/src/app/_constants/footer.ts
index 0a0d1cf86ee..1472a12641d 100644
--- a/packages/twenty-website-new/src/app/_constants/footer.ts
+++ b/packages/twenty-website-new/src/app/_constants/footer.ts
@@ -1,10 +1,7 @@
import type { FooterDataType } from '@/sections/Footer/types';
export const FOOTER_DATA: FooterDataType = {
- illustration: {
- src: '/illustrations/common/footer/footer.glb',
- title: 'Footer background',
- },
+ illustration: 'footerBackground',
bottom: {
copyright: '© 2026 – Twenty',
},
diff --git a/packages/twenty-website-new/src/app/partner/_constants/hero.ts b/packages/twenty-website-new/src/app/partner/_constants/hero.ts
index 44f197e5340..e537c7fd491 100644
--- a/packages/twenty-website-new/src/app/partner/_constants/hero.ts
+++ b/packages/twenty-website-new/src/app/partner/_constants/hero.ts
@@ -8,8 +8,6 @@ export const HERO_DATA: HeroIllustrationDataType = {
body: {
text: "We're building the #1 open-source CRM, but we can't do it alone. Join our partner ecosystem and grow with us.",
},
- illustration: {
- src: 'https://app.endlesstools.io/embed/1c6c8259-3276-4cf2-84d8-6b7e87e7ec95',
- title: 'Partner hero illustration',
- },
+ illustration:
+ 'https://app.endlesstools.io/embed/1c6c8259-3276-4cf2-84d8-6b7e87e7ec95',
};
diff --git a/packages/twenty-website-new/src/app/partner/_constants/three-cards-illustration.ts b/packages/twenty-website-new/src/app/partner/_constants/three-cards-illustration.ts
index df57bbce347..a663354edc7 100644
--- a/packages/twenty-website-new/src/app/partner/_constants/three-cards-illustration.ts
+++ b/packages/twenty-website-new/src/app/partner/_constants/three-cards-illustration.ts
@@ -24,10 +24,7 @@ export const THREE_CARDS_ILLUSTRATION_DATA: ThreeCardsIllustrationDataType = {
{ text: 'Soon: earn revenue' },
],
attribution: undefined,
- illustration: {
- src: '/illustrations/partner/three-cards-illustration/one.glb',
- title: 'Technology partners illustration',
- },
+ illustration: 'programming',
},
{
heading: { text: 'Content & Community Partners', fontFamily: 'sans' },
@@ -40,10 +37,7 @@ export const THREE_CARDS_ILLUSTRATION_DATA: ThreeCardsIllustrationDataType = {
{ text: 'Marketing assets & brand resources' },
],
attribution: undefined,
- illustration: {
- src: '/illustrations/partner/three-cards-illustration/two.glb',
- title: 'Content and community partners illustration',
- },
+ illustration: 'connect',
},
{
heading: { text: 'Solutions Partners', fontFamily: 'sans' },
@@ -56,10 +50,7 @@ export const THREE_CARDS_ILLUSTRATION_DATA: ThreeCardsIllustrationDataType = {
{ text: 'Dedicated partner support' },
],
attribution: undefined,
- illustration: {
- src: '/illustrations/partner/three-cards-illustration/three.glb',
- title: 'Solutions partners illustration',
- },
+ illustration: 'grow',
},
],
};
diff --git a/packages/twenty-website-new/src/app/pricing/_constants/plans.ts b/packages/twenty-website-new/src/app/pricing/_constants/plans.ts
index 1ca22c0ac9e..5861e678ac0 100644
--- a/packages/twenty-website-new/src/app/pricing/_constants/plans.ts
+++ b/packages/twenty-website-new/src/app/pricing/_constants/plans.ts
@@ -4,16 +4,6 @@ const ORGANIZATION_HEADING = {
text: 'Organization',
};
-const PRO_ILLUSTRATION = {
- src: '/illustrations/pricing/Price/pro.glb',
- title: 'Pro plan illustration',
-};
-
-const ORGANIZATION_ILLUSTRATION = {
- src: '/illustrations/pricing/Price/organization.glb',
- title: 'Organization plan illustration',
-};
-
const PRO_FEATURES_TITLE = { text: 'Key Features' };
const ORGANIZATION_FEATURES_TITLE = { text: 'everything in pro +' };
@@ -87,7 +77,7 @@ export const PLANS_DATA = {
},
featuresTitle: ORGANIZATION_FEATURES_TITLE,
heading: ORGANIZATION_HEADING,
- illustration: ORGANIZATION_ILLUSTRATION,
+ illustration: 'planOrganization',
},
pro: {
cells: {
@@ -126,6 +116,6 @@ export const PLANS_DATA = {
},
featuresTitle: PRO_FEATURES_TITLE,
heading: PRO_HEADING,
- illustration: PRO_ILLUSTRATION,
+ illustration: 'planPro',
},
} satisfies PlansDataType;
diff --git a/packages/twenty-website-new/src/app/product/_constants/hero.ts b/packages/twenty-website-new/src/app/product/_constants/hero.ts
index 0bfc0ac9299..7cb9083afca 100644
--- a/packages/twenty-website-new/src/app/product/_constants/hero.ts
+++ b/packages/twenty-website-new/src/app/product/_constants/hero.ts
@@ -8,8 +8,5 @@ export const HERO_DATA: HeroIllustrationDataType = {
body: {
text: 'Modern interface. AI assistance. All the features you need, ready from day one.',
},
- illustration: {
- src: '/illustrations/product/hero/hero.glb',
- title: 'Product hero illustration',
- },
+ illustration: 'heroProduct',
};
diff --git a/packages/twenty-website-new/src/app/product/_constants/three-cards.ts b/packages/twenty-website-new/src/app/product/_constants/three-cards.ts
index 61a1e6a05fd..046e0922a3f 100644
--- a/packages/twenty-website-new/src/app/product/_constants/three-cards.ts
+++ b/packages/twenty-website-new/src/app/product/_constants/three-cards.ts
@@ -17,10 +17,7 @@ export const THREE_CARDS_ILLUSTRATION_DATA: ThreeCardsIllustrationDataType = {
},
benefits: undefined,
attribution: undefined,
- illustration: {
- src: '/illustrations/product/three-cards-illustration/one.glb',
- title: 'Built for speed illustration',
- },
+ illustration: 'speed',
},
{
heading: { text: 'Real-time data', fontFamily: 'sans' },
@@ -29,10 +26,7 @@ export const THREE_CARDS_ILLUSTRATION_DATA: ThreeCardsIllustrationDataType = {
},
benefits: undefined,
attribution: undefined,
- illustration: {
- src: '/illustrations/product/three-cards-illustration/two.glb',
- title: 'Real-time data illustration',
- },
+ illustration: 'eye',
},
{
heading: { text: 'Stay in Flow', fontFamily: 'sans' },
@@ -41,10 +35,7 @@ export const THREE_CARDS_ILLUSTRATION_DATA: ThreeCardsIllustrationDataType = {
},
benefits: undefined,
attribution: undefined,
- illustration: {
- src: '/illustrations/product/three-cards-illustration/three.glb',
- title: 'Stay in flow illustration',
- },
+ illustration: 'singleScreen',
},
],
};
diff --git a/packages/twenty-website-new/src/app/why-twenty/_constants/quote.ts b/packages/twenty-website-new/src/app/why-twenty/_constants/quote.ts
index 7a22feb73e1..62809c78859 100644
--- a/packages/twenty-website-new/src/app/why-twenty/_constants/quote.ts
+++ b/packages/twenty-website-new/src/app/why-twenty/_constants/quote.ts
@@ -1,10 +1,7 @@
import type { QuoteDataType } from '@/sections/Quote/types/QuoteData';
export const QUOTE_DATA: QuoteDataType = {
- illustration: {
- src: '/illustrations/why-twenty/quote/quote.glb',
- title: 'Quote illustration',
- },
+ illustration: 'quoteQuotes',
heading: [
{ text: '“In the AI age,\n', fontFamily: 'serif' },
{ text: ' convergence accelerates”', fontFamily: 'sans' },
diff --git a/packages/twenty-website-new/src/app/why-twenty/_constants/stepper.ts b/packages/twenty-website-new/src/app/why-twenty/_constants/stepper.ts
index 5bb3b4e7b6e..263ab378dd2 100644
--- a/packages/twenty-website-new/src/app/why-twenty/_constants/stepper.ts
+++ b/packages/twenty-website-new/src/app/why-twenty/_constants/stepper.ts
@@ -13,8 +13,5 @@ export const STEPPER_DATA: WhyTwentyStepperDataType = {
text: 'Because in the AI age, the winners will not be the companies with the most dashboards. They will be the companies whose systems turn information into decisions, and decisions into action, faster than everyone else.',
},
],
- illustration: {
- src: '/illustrations/why-twenty/stepper/logo.glb',
- title: 'Our vision illustration',
- },
+ illustration: 'whyTwentyStepperLogo',
};
diff --git a/packages/twenty-website-new/src/design-system/components/Illustration/types/Illustration.ts b/packages/twenty-website-new/src/design-system/components/Illustration/types/Illustration.ts
deleted file mode 100644
index 58ca3171a3e..00000000000
--- a/packages/twenty-website-new/src/design-system/components/Illustration/types/Illustration.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export type IllustrationType = {
- src: string;
- title: string;
-};
diff --git a/packages/twenty-website-new/src/sections/Faq/components/FaqVisual/FaqVisual.tsx b/packages/twenty-website-new/src/illustrations/Faq/Background.tsx
similarity index 87%
rename from packages/twenty-website-new/src/sections/Faq/components/FaqVisual/FaqVisual.tsx
rename to packages/twenty-website-new/src/illustrations/Faq/Background.tsx
index 505cb1ac26c..8a537fadf9f 100644
--- a/packages/twenty-website-new/src/sections/Faq/components/FaqVisual/FaqVisual.tsx
+++ b/packages/twenty-website-new/src/illustrations/Faq/Background.tsx
@@ -6,14 +6,10 @@ import { useEffect, useRef } from 'react';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-const FAQ_VISUAL_MODEL_FIT_SCALE = 4;
-const FAQ_VISUAL_ROTATION_RADIANS_PER_SECOND = 0.5;
-const FAQ_VISUAL_WORLD_OFFSET_Y = 0.52;
+const GLB_URL = '/illustrations/common/faq/faq.glb';
// World spin axis (x, y, z). Camera on +Z: (0,0,1) = spinner in the view plane.
// Try (0,1,0) or (1,0,0) if motion or framing looks wrong.
-const FAQ_VISUAL_SPIN_AXIS_XYZ: readonly [number, number, number] = [0, 0, 1];
-
const scanlineVertexShader = /* glsl */ `
varying vec3 vWorldPosition;
varying vec3 vWorldNormal;
@@ -143,12 +139,7 @@ const FaqVisualCanvasMount = styled.div`
width: 100%;
`;
-export type FaqVisualProps = {
- src: string;
- title: string;
-};
-
-export function FaqVisual({ src, title }: FaqVisualProps) {
+export function FaqBackground() {
const mountReference = useRef<HTMLDivElement>(null);
useEffect(() => {
@@ -183,17 +174,13 @@ export function FaqVisual({ src, title }: FaqVisualProps) {
const wheel = new THREE.Group();
scene.add(wheel);
- const spinAxisWorld = new THREE.Vector3(
- FAQ_VISUAL_SPIN_AXIS_XYZ[0],
- FAQ_VISUAL_SPIN_AXIS_XYZ[1],
- FAQ_VISUAL_SPIN_AXIS_XYZ[2],
- ).normalize();
+ const spinAxisWorld = new THREE.Vector3(0, 0, 1).normalize();
const clock = new THREE.Clock();
const loader = new GLTFLoader();
loader.load(
- src,
+ GLB_URL,
(gltf) => {
if (cancelled) {
disposeObjectSubtree(gltf.scene);
@@ -205,14 +192,14 @@ export function FaqVisual({ src, title }: FaqVisualProps) {
const center = bounds.getCenter(new THREE.Vector3());
const size = bounds.getSize(new THREE.Vector3());
const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
- const scale = FAQ_VISUAL_MODEL_FIT_SCALE / maxAxis;
+ const scale = 4 / maxAxis;
modelRoot.position.sub(center);
modelRoot.scale.setScalar(scale);
applyScanlineMaterials(modelRoot, lightDirectionWorld);
wheel.add(modelRoot);
- wheel.position.y = FAQ_VISUAL_WORLD_OFFSET_Y;
+ wheel.position.y = 0.52;
const renderFrame = () => {
if (cancelled) {
@@ -221,10 +208,7 @@ export function FaqVisual({ src, title }: FaqVisualProps) {
animationFrameId = window.requestAnimationFrame(renderFrame);
const delta = Math.min(clock.getDelta(), 0.1);
- wheel.rotateOnWorldAxis(
- spinAxisWorld,
- -delta * FAQ_VISUAL_ROTATION_RADIANS_PER_SECOND,
- );
+ wheel.rotateOnWorldAxis(spinAxisWorld, -delta * 0.5);
renderer.render(scene, camera);
};
@@ -262,15 +246,11 @@ export function FaqVisual({ src, title }: FaqVisualProps) {
container.removeChild(canvas);
}
};
- }, [src]);
+ }, []);
return (
<FaqVisualShell>
- <FaqVisualCanvasMount
- aria-label={title}
- ref={mountReference}
- role="img"
- />
+ <FaqVisualCanvasMount aria-hidden ref={mountReference} />
</FaqVisualShell>
);
}
diff --git a/packages/twenty-website-new/src/sections/Footer/components/FooterVisual/FooterVisual.tsx b/packages/twenty-website-new/src/illustrations/Footer/Background.tsx
similarity index 90%
rename from packages/twenty-website-new/src/sections/Footer/components/FooterVisual/FooterVisual.tsx
rename to packages/twenty-website-new/src/illustrations/Footer/Background.tsx
index e1fef9a4d4b..4e7731c2cd0 100644
--- a/packages/twenty-website-new/src/sections/Footer/components/FooterVisual/FooterVisual.tsx
+++ b/packages/twenty-website-new/src/illustrations/Footer/Background.tsx
@@ -5,16 +5,9 @@ import { useEffect, useRef } from 'react';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-// Framing for the extruded “ZO” hero shot (low angle, centered, room below for links).
-const FOOTER_VISUAL_MODEL_FIT_SCALE = 5;
-const FOOTER_VISUAL_MODEL_OFFSET_Y = 0.42;
-const FOOTER_VISUAL_CAMERA_POSITION: readonly [number, number, number] = [
- 0, -1.35, 7.4,
-];
-const FOOTER_VISUAL_CAMERA_LOOK_AT: readonly [number, number, number] = [
- 0, 0.55, 0,
-];
+const GLB_URL = '/illustrations/common/footer/footer.glb';
+// Framing for the extruded “ZO” hero shot (low angle, centered, room below for links).
const scanlineVertexShader = /* glsl */ `
varying vec3 vWorldPosition;
varying vec3 vWorldNormal;
@@ -131,6 +124,21 @@ function applyFooterScanlineMaterials(
});
}
+const FooterBackgroundCanvasRoot = styled.div`
+ position: absolute;
+ inset: 0;
+ z-index: 0;
+ pointer-events: none;
+ overflow: hidden;
+
+ & canvas {
+ display: block;
+ height: 100%;
+ pointer-events: auto;
+ width: 100%;
+ }
+`;
+
const FooterVisualCanvasMount = styled.div`
display: block;
height: 100%;
@@ -138,12 +146,7 @@ const FooterVisualCanvasMount = styled.div`
width: 100%;
`;
-export type FooterVisualProps = {
- src: string;
- title: string;
-};
-
-export function FooterVisual({ src, title }: FooterVisualProps) {
+export function FooterBackground() {
const mountReference = useRef<HTMLDivElement>(null);
useEffect(() => {
@@ -164,18 +167,8 @@ export function FooterVisual({ src, title }: FooterVisualProps) {
const height = container.clientHeight;
const camera = new THREE.PerspectiveCamera(42, width / height, 0.1, 100);
- camera.position.set(
- FOOTER_VISUAL_CAMERA_POSITION[0],
- FOOTER_VISUAL_CAMERA_POSITION[1],
- FOOTER_VISUAL_CAMERA_POSITION[2],
- );
- camera.lookAt(
- new THREE.Vector3(
- FOOTER_VISUAL_CAMERA_LOOK_AT[0],
- FOOTER_VISUAL_CAMERA_LOOK_AT[1],
- FOOTER_VISUAL_CAMERA_LOOK_AT[2],
- ),
- );
+ camera.position.set(0, -1.35, 7.4);
+ camera.lookAt(new THREE.Vector3(0, 0.55, 0));
const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
@@ -197,7 +190,7 @@ export function FooterVisual({ src, title }: FooterVisualProps) {
const loader = new GLTFLoader();
loader.load(
- src,
+ GLB_URL,
(gltf) => {
if (cancelled) {
disposeObjectSubtree(gltf.scene);
@@ -209,11 +202,11 @@ export function FooterVisual({ src, title }: FooterVisualProps) {
const center = bounds.getCenter(new THREE.Vector3());
const size = bounds.getSize(new THREE.Vector3());
const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
- const scale = FOOTER_VISUAL_MODEL_FIT_SCALE / maxAxis;
+ const scale = 5 / maxAxis;
modelRoot.position.sub(center);
modelRoot.scale.setScalar(scale);
- modelRoot.position.y += FOOTER_VISUAL_MODEL_OFFSET_Y;
+ modelRoot.position.y += 0.42;
applyFooterScanlineMaterials(modelRoot, lightDirectionWorld);
pivot.add(modelRoot);
@@ -341,13 +334,11 @@ export function FooterVisual({ src, title }: FooterVisualProps) {
container.removeChild(canvas);
}
};
- }, [src]);
+ }, []);
return (
- <FooterVisualCanvasMount
- aria-label={title}
- ref={mountReference}
- role="img"
- />
+ <FooterBackgroundCanvasRoot aria-hidden>
+ <FooterVisualCanvasMount ref={mountReference} />
+ </FooterBackgroundCanvasRoot>
);
}
diff --git a/packages/twenty-website-new/src/illustrations/Helped/Money.tsx b/packages/twenty-website-new/src/illustrations/Helped/Money.tsx
new file mode 100644
index 00000000000..4db80d3bb42
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/Helped/Money.tsx
@@ -0,0 +1,368 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/home/helped/money.glb';
+
+const scanlineVertexShader = /* glsl */ `
+ varying vec3 vWorldPosition;
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldPosition = worldPosition.xyz;
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const scanlineFragmentShader = /* glsl */ `
+ uniform vec3 uCameraPosition;
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform float uStripeScale;
+
+ varying vec3 vWorldPosition;
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ vec3 viewDir = normalize(uCameraPosition - vWorldPosition);
+ float ndotl = max(dot(normal, lightDir), 0.05);
+ float ndotv = abs(dot(normal, viewDir));
+
+ float y = vWorldPosition.y * uStripeScale;
+ float cell = fract(y);
+
+ // Narrow colored bands so most of each stripe period reads as background.
+ float shadowWeight = mix(1.0, 0.62, ndotl);
+ float lineWidth = 0.26 * shadowWeight;
+ float edge = 0.024;
+ float band = 1.0 - smoothstep(lineWidth, lineWidth + edge, cell);
+
+ float highlight = pow(ndotl, 1.25);
+ float dash = fract(vWorldPosition.x * 18.0 + vWorldPosition.z * 5.0);
+ float dashMask = mix(
+ 1.0,
+ smoothstep(0.18, 0.48, dash) * (1.0 - smoothstep(0.58, 0.86, dash)),
+ highlight * 0.4
+ );
+ band *= dashMask;
+
+ float speckle = fract(
+ sin(dot(vWorldPosition.xz, vec2(127.1, 311.7))) * 43758.5453
+ );
+ band *= mix(1.0, 0.62 + 0.38 * step(0.42, speckle), highlight * 0.42);
+
+ // Silhouettes and shadowed sides fall back to transparent (card shows through).
+ float viewFacing = pow(clamp(ndotv, 0.04, 1.0), 0.52);
+ float lightFacing = pow(clamp(ndotl, 0.1, 1.0), 0.88);
+ float alpha = band * viewFacing * lightFacing;
+
+ // Brighten RGB vs flat uColor; alpha above still drives edge transparency.
+ float lightTint = mix(0.72, 1.58, pow(ndotl, 0.82));
+ float viewTint = mix(0.88, 1.14, viewFacing);
+ const float colorGain = 1.22;
+ vec3 lit = uColor * lightTint * viewTint * colorGain;
+
+ if (alpha < 0.02) {
+ discard;
+ }
+
+ gl_FragColor = vec4(lit, alpha);
+ }
+`;
+
+function createScanlineMaterial(
+ lightDirection: THREE.Vector3,
+ stripeColor: string,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uCameraPosition: { value: new THREE.Vector3() },
+ uColor: { value: new THREE.Color(stripeColor) },
+ uLightDir: { value: lightDirection.clone() },
+ uStripeScale: { value: 23.0 },
+ },
+ vertexShader: scanlineVertexShader,
+ fragmentShader: scanlineFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyScanlineMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ stripeColor: string,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createScanlineMaterial(lightDirection, stripeColor);
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.helpedMoneyMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Money() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const cameraWorldPosition = new THREE.Vector3();
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = (2.75 * 1.1) / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ applyScanlineMaterials(modelRoot, lightDirectionWorld, '#E4E58A');
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const motion = 1.1;
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * motion * influence;
+ targetRotation.x = pointer.y * 0.62 * motion * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(
+ pivot.scale.x,
+ 1 + hoverLift * 0.12 * motion,
+ 7,
+ delta,
+ ),
+ );
+
+ const pointerFollow = pointer.inside ? 1 : 0.32;
+ const mx = pointer.x * pointerFollow;
+ const my = pointer.y * pointerFollow;
+ const wobbleAttenuation = pointer.inside ? 1 : 0.36;
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.helpedMoneyMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ sceneObject.position.x =
+ rest.position.x + mx * motion * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * motion * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y +
+ (mx + my) * motion * 0.055 * Math.sin(phase * 2.5);
+
+ const twist =
+ motion *
+ (mx * 0.34 + my * 0.24) *
+ wobbleAttenuation *
+ Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ camera.getWorldPosition(cameraWorldPosition);
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+ const material = sceneObject.material;
+ if (
+ material instanceof THREE.ShaderMaterial &&
+ material.uniforms.uCameraPosition
+ ) {
+ material.uniforms.uCameraPosition.value.copy(cameraWorldPosition);
+ }
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/Helped/Spaceship.tsx b/packages/twenty-website-new/src/illustrations/Helped/Spaceship.tsx
new file mode 100644
index 00000000000..9daed3ae003
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/Helped/Spaceship.tsx
@@ -0,0 +1,368 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/home/helped/spaceship.glb';
+
+const scanlineVertexShader = /* glsl */ `
+ varying vec3 vWorldPosition;
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldPosition = worldPosition.xyz;
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const scanlineFragmentShader = /* glsl */ `
+ uniform vec3 uCameraPosition;
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform float uStripeScale;
+
+ varying vec3 vWorldPosition;
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ vec3 viewDir = normalize(uCameraPosition - vWorldPosition);
+ float ndotl = max(dot(normal, lightDir), 0.05);
+ float ndotv = abs(dot(normal, viewDir));
+
+ float y = vWorldPosition.y * uStripeScale;
+ float cell = fract(y);
+
+ // Narrow colored bands so most of each stripe period reads as background.
+ float shadowWeight = mix(1.0, 0.62, ndotl);
+ float lineWidth = 0.26 * shadowWeight;
+ float edge = 0.024;
+ float band = 1.0 - smoothstep(lineWidth, lineWidth + edge, cell);
+
+ float highlight = pow(ndotl, 1.25);
+ float dash = fract(vWorldPosition.x * 18.0 + vWorldPosition.z * 5.0);
+ float dashMask = mix(
+ 1.0,
+ smoothstep(0.18, 0.48, dash) * (1.0 - smoothstep(0.58, 0.86, dash)),
+ highlight * 0.4
+ );
+ band *= dashMask;
+
+ float speckle = fract(
+ sin(dot(vWorldPosition.xz, vec2(127.1, 311.7))) * 43758.5453
+ );
+ band *= mix(1.0, 0.62 + 0.38 * step(0.42, speckle), highlight * 0.42);
+
+ // Silhouettes and shadowed sides fall back to transparent (card shows through).
+ float viewFacing = pow(clamp(ndotv, 0.04, 1.0), 0.52);
+ float lightFacing = pow(clamp(ndotl, 0.1, 1.0), 0.88);
+ float alpha = band * viewFacing * lightFacing;
+
+ // Brighten RGB vs flat uColor; alpha above still drives edge transparency.
+ float lightTint = mix(0.72, 1.58, pow(ndotl, 0.82));
+ float viewTint = mix(0.88, 1.14, viewFacing);
+ const float colorGain = 1.22;
+ vec3 lit = uColor * lightTint * viewTint * colorGain;
+
+ if (alpha < 0.02) {
+ discard;
+ }
+
+ gl_FragColor = vec4(lit, alpha);
+ }
+`;
+
+function createScanlineMaterial(
+ lightDirection: THREE.Vector3,
+ stripeColor: string,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uCameraPosition: { value: new THREE.Vector3() },
+ uColor: { value: new THREE.Color(stripeColor) },
+ uLightDir: { value: lightDirection.clone() },
+ uStripeScale: { value: 23.0 },
+ },
+ vertexShader: scanlineVertexShader,
+ fragmentShader: scanlineFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyScanlineMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ stripeColor: string,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createScanlineMaterial(lightDirection, stripeColor);
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.helpedSpaceshipMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Spaceship() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const cameraWorldPosition = new THREE.Vector3();
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = (2.75 * 1.1) / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ applyScanlineMaterials(modelRoot, lightDirectionWorld, '#89FC9A');
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const motion = 1.1;
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * motion * influence;
+ targetRotation.x = pointer.y * 0.62 * motion * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(
+ pivot.scale.x,
+ 1 + hoverLift * 0.12 * motion,
+ 7,
+ delta,
+ ),
+ );
+
+ const pointerFollow = pointer.inside ? 1 : 0.32;
+ const mx = pointer.x * pointerFollow;
+ const my = pointer.y * pointerFollow;
+ const wobbleAttenuation = pointer.inside ? 1 : 0.36;
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.helpedSpaceshipMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ sceneObject.position.x =
+ rest.position.x + mx * motion * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * motion * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y +
+ (mx + my) * motion * 0.055 * Math.sin(phase * 2.5);
+
+ const twist =
+ motion *
+ (mx * 0.34 + my * 0.24) *
+ wobbleAttenuation *
+ Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ camera.getWorldPosition(cameraWorldPosition);
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+ const material = sceneObject.material;
+ if (
+ material instanceof THREE.ShaderMaterial &&
+ material.uniforms.uCameraPosition
+ ) {
+ material.uniforms.uCameraPosition.value.copy(cameraWorldPosition);
+ }
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/sections/Helped/components/Card/HelpedCardVisual.tsx b/packages/twenty-website-new/src/illustrations/Helped/Target.tsx
similarity index 92%
rename from packages/twenty-website-new/src/sections/Helped/components/Card/HelpedCardVisual.tsx
rename to packages/twenty-website-new/src/illustrations/Helped/Target.tsx
index c8df9c8123b..e227135add7 100644
--- a/packages/twenty-website-new/src/sections/Helped/components/Card/HelpedCardVisual.tsx
+++ b/packages/twenty-website-new/src/illustrations/Helped/Target.tsx
@@ -5,11 +5,7 @@ import { useEffect, useRef } from 'react';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-// Multiplies pointer tilt, idle follow, hover zoom, and mesh wobble amplitudes.
-const HELPED_CARD_VISUAL_MOTION_SCALE = 1.1;
-
-// Model scale in the 240px frame — larger = bigger asset on screen.
-const HELPED_CARD_VISUAL_MODEL_FIT_SCALE = 2.75 * 1.1;
+const GLB_URL = '/illustrations/home/helped/target.glb';
const scanlineVertexShader = /* glsl */ `
varying vec3 vWorldPosition;
@@ -142,7 +138,7 @@ function applyScanlineMaterials(
quaternion: mesh.quaternion.clone(),
wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
};
- mesh.userData.helpedCardVisualRest = rest;
+ mesh.userData.helpedTargetMeshRest = rest;
});
}
@@ -153,17 +149,7 @@ const StyledVisualMount = styled.div`
width: 100%;
`;
-export type HelpedCardVisualProps = {
- src: string;
- stripeColor: string;
- title: string;
-};
-
-export function HelpedCardVisual({
- src,
- stripeColor,
- title,
-}: HelpedCardVisualProps) {
+export function Target() {
const mountReference = useRef<HTMLDivElement>(null);
useEffect(() => {
@@ -207,7 +193,7 @@ export function HelpedCardVisual({
const loader = new GLTFLoader();
loader.load(
- src,
+ GLB_URL,
(gltf) => {
if (cancelled) {
disposeObjectSubtree(gltf.scene);
@@ -219,12 +205,12 @@ export function HelpedCardVisual({
const center = bounds.getCenter(new THREE.Vector3());
const size = bounds.getSize(new THREE.Vector3());
const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
- const scale = HELPED_CARD_VISUAL_MODEL_FIT_SCALE / maxAxis;
+ const scale = (2.75 * 1.1) / maxAxis;
modelRoot.position.sub(center);
modelRoot.scale.setScalar(scale);
- applyScanlineMaterials(modelRoot, lightDirectionWorld, stripeColor);
+ applyScanlineMaterials(modelRoot, lightDirectionWorld, '#DE8CF6');
pivot.add(modelRoot);
const renderFrame = () => {
@@ -235,7 +221,7 @@ export function HelpedCardVisual({
animationFrameId = window.requestAnimationFrame(renderFrame);
const delta = Math.min(clock.getDelta(), 0.1);
- const motion = HELPED_CARD_VISUAL_MOTION_SCALE;
+ const motion = 1.1;
const rotationDamp = 6.8;
const influence = pointer.inside ? 1 : 0.38;
targetRotation.y = pointer.x * 0.78 * motion * influence;
@@ -274,7 +260,7 @@ export function HelpedCardVisual({
return;
}
- const rest = sceneObject.userData.helpedCardVisualRest as
+ const rest = sceneObject.userData.helpedTargetMeshRest as
| MeshRestPose
| undefined;
if (!rest) {
@@ -376,9 +362,7 @@ export function HelpedCardVisual({
container.removeChild(canvas);
}
};
- }, [src, stripeColor]);
+ }, []);
- return (
- <StyledVisualMount aria-label={title} ref={mountReference} role="img" />
- );
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
}
diff --git a/packages/twenty-website-new/src/sections/Hero/components/ProductVisual/ProductVisual.tsx b/packages/twenty-website-new/src/illustrations/Hero/Product.tsx
similarity index 98%
rename from packages/twenty-website-new/src/sections/Hero/components/ProductVisual/ProductVisual.tsx
rename to packages/twenty-website-new/src/illustrations/Hero/Product.tsx
index 5626953def9..646afaa098e 100644
--- a/packages/twenty-website-new/src/sections/Hero/components/ProductVisual/ProductVisual.tsx
+++ b/packages/twenty-website-new/src/illustrations/Hero/Product.tsx
@@ -6,7 +6,7 @@ import { useEffect, useRef } from 'react';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-const HERO_GLB_URL = '/illustrations/product/hero/hero.glb';
+const GLB_URL = '/illustrations/product/hero/hero.glb';
const StyledContainer = styled.div`
background-color: ${theme.colors.secondary.background[5]};
@@ -138,7 +138,7 @@ function applyScanlineMaterials(
});
}
-export function ProductVisual() {
+export function Product() {
const containerReference = useRef<HTMLDivElement>(null);
useEffect(() => {
@@ -181,7 +181,7 @@ export function ProductVisual() {
const loader = new GLTFLoader();
loader.load(
- HERO_GLB_URL,
+ GLB_URL,
(gltf) => {
if (cancelled) {
disposeObjectSubtree(gltf.scene);
diff --git a/packages/twenty-website-new/src/illustrations/Hero/WhyTwenty.tsx b/packages/twenty-website-new/src/illustrations/Hero/WhyTwenty.tsx
new file mode 100644
index 00000000000..de506a142bd
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/Hero/WhyTwenty.tsx
@@ -0,0 +1,326 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/why-twenty/hero/hero.glb';
+
+const GlbMount = styled.div`
+ display: block;
+ height: 100%;
+ inset: 0;
+ min-width: 0;
+ position: absolute;
+ width: 100%;
+ z-index: 1;
+`;
+
+// Same scanline shader as ProductVisual / IllustrationCardVisual; white uColor for Why Twenty.
+const scanlineVertexShader = /* glsl */ `
+ varying vec3 vLocalPosition;
+ varying vec3 vWorldPosition;
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vLocalPosition = position;
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldPosition = worldPosition.xyz;
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const scanlineFragmentShader = /* glsl */ `
+ uniform vec3 uCameraPosition;
+ uniform vec3 uColor;
+ uniform vec3 uDigitFillColor;
+ uniform vec2 uDigitCenterXY;
+ uniform vec2 uDigitRadiusXY;
+ uniform float uDigitZMin;
+ uniform vec3 uLightDir;
+ uniform float uStripeScale;
+
+ varying vec3 vLocalPosition;
+ varying vec3 vWorldPosition;
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ vec3 viewDir = normalize(uCameraPosition - vWorldPosition);
+ float ndotl = max(dot(normal, lightDir), 0.06);
+ float ndotv = abs(dot(normal, viewDir));
+
+ vec2 delta =
+ (vLocalPosition.xy - uDigitCenterXY) / max(uDigitRadiusXY, vec2(0.0001));
+ float inDigitXY = 1.0 - smoothstep(0.88, 1.42, length(delta));
+ float inDigitZ = smoothstep(uDigitZMin - 2.5, uDigitZMin + 1.2, vLocalPosition.z);
+ float facing = smoothstep(0.08, 0.72, ndotv);
+ float digitMask = clamp(inDigitXY * mix(0.55, 1.0, inDigitZ) * facing, 0.0, 1.0);
+
+ if (digitMask > 0.62) {
+ gl_FragColor = vec4(uDigitFillColor, 1.0);
+ return;
+ }
+
+ // Single-mesh GLB: offset stripe phase by normal so cutout "20" walls do not line up with the
+ // rear face (reduces moiré / camouflage).
+ float stripePhase =
+ vWorldPosition.y * uStripeScale +
+ (normal.x * 1.15 + normal.z * 0.9 + normal.y * 0.5) * 3.4;
+ float cell = fract(stripePhase);
+
+ // Grazing / engraved faces read brighter and keep slightly wider bands.
+ float groove = smoothstep(0.1, 0.92, 1.0 - ndotv);
+
+ float shadowWeight = mix(1.0, 0.48, ndotl);
+ shadowWeight *= mix(1.0, 0.78, groove * 0.7);
+
+ float lineWidth = 0.58 * shadowWeight;
+ float edge = 0.035;
+ float band = 1.0 - smoothstep(lineWidth, lineWidth + edge, cell);
+
+ float highlight = pow(ndotl, 1.35);
+ float dash = fract(vWorldPosition.x * 20.0 + vWorldPosition.z * 6.0);
+ float dashMask = mix(
+ 1.0,
+ smoothstep(0.15, 0.45, dash) * (1.0 - smoothstep(0.55, 0.88, dash)),
+ highlight
+ );
+ band *= dashMask;
+
+ float speckle = fract(
+ sin(dot(vWorldPosition.xz, vec2(127.1, 311.7))) * 43758.5453
+ );
+ band *= mix(1.0, 0.55 + 0.45 * step(0.4, speckle), highlight * 0.85);
+
+ if (band < 0.015) {
+ discard;
+ }
+
+ vec3 lit = uColor * mix(0.78, 1.22, ndotl);
+ lit *= 1.0 + groove * 0.5;
+ lit *= 1.0 + smoothstep(0.4, 0.92, 1.0 - ndotv) * 0.22;
+
+ gl_FragColor = vec4(lit, band);
+ }
+`;
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+ sceneObject.geometry?.dispose();
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+function createWhyTwentyScanlineMaterial(lightDirection: THREE.Vector3) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uCameraPosition: { value: new THREE.Vector3() },
+ uColor: { value: new THREE.Color('#ffffff') },
+ uDigitFillColor: { value: new THREE.Color('#0a0a0c') },
+ uDigitCenterXY: { value: new THREE.Vector2(0, 0) },
+ uDigitRadiusXY: { value: new THREE.Vector2(1, 1) },
+ uDigitZMin: { value: 0 },
+ uLightDir: { value: lightDirection.clone() },
+ uStripeScale: { value: 16.0 },
+ },
+ vertexShader: scanlineVertexShader,
+ fragmentShader: scanlineFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function applyWhyTwentyScanlineMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const geometry = sceneObject.geometry;
+ if (!geometry.getAttribute('position')) {
+ return;
+ }
+
+ geometry.computeBoundingBox();
+ const box = geometry.boundingBox;
+ if (!box) {
+ return;
+ }
+
+ const centerX = (box.min.x + box.max.x) / 2;
+ const centerY = (box.min.y + box.max.y) / 2;
+ const sizeX = box.max.x - box.min.x;
+ const sizeY = box.max.y - box.min.y;
+ const sizeZ = box.max.z - box.min.z;
+
+ const material = createWhyTwentyScanlineMaterial(lightDirection);
+ material.uniforms.uDigitCenterXY.value.set(centerX, centerY);
+ material.uniforms.uDigitRadiusXY.value.set(
+ Math.max(sizeX * 0.135, 0.01),
+ Math.max(sizeY * 0.105, 0.01),
+ );
+ material.uniforms.uDigitZMin.value = box.max.z - sizeZ * 0.14;
+
+ sceneObject.material = material;
+ });
+}
+
+export function WhyTwenty() {
+ const glbMountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = glbMountReference.current;
+ if (!container) return;
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.2);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'crosshair';
+ container.appendChild(canvas);
+
+ const clock = new THREE.Clock();
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+ const cameraWorldPosition = new THREE.Vector3();
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ let targetRotationX = 0;
+ let targetRotationY = 0;
+
+ const loader = new GLTFLoader();
+ loader.load(GLB_URL, (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+
+ const scale = 1.65 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ modelRoot.rotation.set(0, -0.2, -0.2);
+
+ applyWhyTwentyScanlineMaterials(modelRoot, lightDirectionWorld);
+
+ pivot.add(modelRoot);
+
+ pivot.position.x = 0.25;
+
+ const renderFrame = () => {
+ if (cancelled) return;
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const time = clock.getElapsedTime();
+
+ // Elegant, breathing float animation
+ pivot.position.y = Math.sin(time * 1.5) * 0.06;
+
+ // Fluid, luxurious mouse interaction (damped)
+ pivot.rotation.x += (targetRotationX - pivot.rotation.x) * 0.05;
+ pivot.rotation.y += (targetRotationY - pivot.rotation.y) * 0.05;
+
+ camera.getWorldPosition(cameraWorldPosition);
+ modelRoot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uCameraPosition
+ ) {
+ sceneObject.material.uniforms.uCameraPosition.value.copy(
+ cameraWorldPosition,
+ );
+ }
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ });
+
+ const handlePointerMove = (e: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const x = ((e.clientX - rect.left) / rect.width) * 2 - 1;
+ const y = -(((e.clientY - rect.top) / rect.height) * 2 - 1);
+
+ // Subtle tilt ranges
+ targetRotationY = x * 0.35;
+ targetRotationX = y * 0.25;
+ };
+
+ const handlePointerLeave = () => {
+ targetRotationX = 0;
+ targetRotationY = 0;
+ };
+
+ const handleResize = () => {
+ if (!container || cancelled) return;
+ const nextWidth = container.clientWidth;
+ const nextHeight = container.clientHeight;
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+ };
+
+ canvas.addEventListener('pointermove', handlePointerMove);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <GlbMount aria-hidden ref={glbMountReference} />;
+}
diff --git a/packages/twenty-website-new/src/sections/Plans/components/Card/PlanCardVisual.tsx b/packages/twenty-website-new/src/illustrations/Plans/Organization.tsx
similarity index 85%
rename from packages/twenty-website-new/src/sections/Plans/components/Card/PlanCardVisual.tsx
rename to packages/twenty-website-new/src/illustrations/Plans/Organization.tsx
index d1a2f874e67..0e4d4ac5777 100644
--- a/packages/twenty-website-new/src/sections/Plans/components/Card/PlanCardVisual.tsx
+++ b/packages/twenty-website-new/src/illustrations/Plans/Organization.tsx
@@ -4,12 +4,7 @@ import { useEffect, useRef } from 'react';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-const PLAN_CARD_VISUAL_MODEL_FIT_SCALE = 2.35;
-const PLAN_CARD_IDLE_TILT_INFLUENCE = 0.22;
-const PLAN_CARD_HOVER_SCALE_LIFT = 0.06;
-const PLAN_CARD_ROTATION_DAMP = 8.2;
-const PLAN_CARD_TILT_X = 0.42;
-const PLAN_CARD_TILT_Y = 0.52;
+const GLB_URL = '/illustrations/pricing/Price/organization.glb';
const scanlineVertexShader = /* glsl */ `
varying vec3 vWorldPosition;
@@ -123,24 +118,11 @@ function applyScanlineMaterials(
quaternion: mesh.quaternion.clone(),
wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
};
- mesh.userData.planCardVisualRest = rest;
+ mesh.userData.planOrganizationMeshRest = rest;
});
}
-// Plain div + stable inline style: Linaria on this node caused SSR/client className mismatches.
-const planCardVisualMountStyle = {
- display: 'block' as const,
- height: '100%',
- minWidth: 0,
- width: '100%',
-};
-
-type PlanCardVisualProps = {
- src: string;
- title: string;
-};
-
-export function PlanCardVisual({ src, title }: PlanCardVisualProps) {
+export function Organization() {
const mountReference = useRef<HTMLDivElement>(null);
useEffect(() => {
@@ -191,7 +173,7 @@ export function PlanCardVisual({ src, title }: PlanCardVisualProps) {
const loader = new GLTFLoader();
loader.load(
- src,
+ GLB_URL,
(gltf) => {
if (cancelled) {
disposeObjectSubtree(gltf.scene);
@@ -203,7 +185,7 @@ export function PlanCardVisual({ src, title }: PlanCardVisualProps) {
const center = bounds.getCenter(new THREE.Vector3());
const size = bounds.getSize(new THREE.Vector3());
const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
- const scale = PLAN_CARD_VISUAL_MODEL_FIT_SCALE / maxAxis;
+ const scale = 2.35 / maxAxis;
modelRoot.position.sub(center);
modelRoot.scale.setScalar(scale);
@@ -219,44 +201,37 @@ export function PlanCardVisual({ src, title }: PlanCardVisualProps) {
animationFrameId = window.requestAnimationFrame(renderFrame);
const delta = Math.min(clock.getDelta(), 0.1);
- const influence = pointer.inside ? 1 : PLAN_CARD_IDLE_TILT_INFLUENCE;
- targetRotation.y = pointer.x * PLAN_CARD_TILT_Y * influence;
- targetRotation.x = pointer.y * PLAN_CARD_TILT_X * influence;
+ const influence = pointer.inside ? 1 : 0.22;
+ targetRotation.y = pointer.x * 0.52 * influence;
+ targetRotation.x = pointer.y * 0.42 * influence;
pivot.rotation.y = THREE.MathUtils.damp(
pivot.rotation.y,
targetRotation.y,
- PLAN_CARD_ROTATION_DAMP,
+ 8.2,
delta,
);
pivot.rotation.x = THREE.MathUtils.damp(
pivot.rotation.x,
targetRotation.x,
- PLAN_CARD_ROTATION_DAMP,
+ 8.2,
delta,
);
const hoverLift = pointer.inside ? 1 : 0;
pivot.scale.setScalar(
- THREE.MathUtils.damp(
- pivot.scale.x,
- 1 + hoverLift * PLAN_CARD_HOVER_SCALE_LIFT,
- 7,
- delta,
- ),
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.06, 7, delta),
);
- const mx =
- pointer.x * (pointer.inside ? 1 : PLAN_CARD_IDLE_TILT_INFLUENCE);
- const my =
- pointer.y * (pointer.inside ? 1 : PLAN_CARD_IDLE_TILT_INFLUENCE);
+ const mx = pointer.x * (pointer.inside ? 1 : 0.22);
+ const my = pointer.y * (pointer.inside ? 1 : 0.22);
modelRoot.traverse((sceneObject) => {
if (!(sceneObject instanceof THREE.Mesh)) {
return;
}
- const rest = sceneObject.userData.planCardVisualRest as
+ const rest = sceneObject.userData.planOrganizationMeshRest as
| MeshRestPose
| undefined;
if (!rest) {
@@ -354,14 +329,18 @@ export function PlanCardVisual({ src, title }: PlanCardVisualProps) {
container.removeChild(canvas);
}
};
- }, [src]);
+ }, []);
return (
<div
- aria-label={title}
+ aria-hidden
ref={mountReference}
- role="img"
- style={planCardVisualMountStyle}
+ style={{
+ display: 'block',
+ height: '100%',
+ minWidth: 0,
+ width: '100%',
+ }}
/>
);
}
diff --git a/packages/twenty-website-new/src/illustrations/Plans/Pro.tsx b/packages/twenty-website-new/src/illustrations/Plans/Pro.tsx
new file mode 100644
index 00000000000..7c9ea5adb61
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/Plans/Pro.tsx
@@ -0,0 +1,346 @@
+'use client';
+
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/pricing/Price/pro.glb';
+
+const scanlineVertexShader = /* glsl */ `
+ varying vec3 vWorldPosition;
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldPosition = worldPosition.xyz;
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const scanlineFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform float uStripeScale;
+
+ varying vec3 vWorldPosition;
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.06);
+
+ float y = vWorldPosition.y * uStripeScale;
+ float cell = fract(y);
+
+ float shadowWeight = mix(1.0, 0.5, ndotl);
+ float lineWidth = 0.58 * shadowWeight;
+ float edge = 0.035;
+ float band = 1.0 - smoothstep(lineWidth, lineWidth + edge, cell);
+
+ float highlight = pow(ndotl, 1.35);
+ float dash = fract(vWorldPosition.x * 20.0 + vWorldPosition.z * 6.0);
+ float dashMask = mix(
+ 1.0,
+ smoothstep(0.15, 0.45, dash) * (1.0 - smoothstep(0.55, 0.88, dash)),
+ highlight
+ );
+ band *= dashMask;
+
+ float speckle = fract(
+ sin(dot(vWorldPosition.xz, vec2(127.1, 311.7))) * 43758.5453
+ );
+ band *= mix(1.0, 0.55 + 0.45 * step(0.4, speckle), highlight * 0.85);
+
+ if (band < 0.015) {
+ discard;
+ }
+
+ vec3 lit = uColor * mix(0.72, 1.18, ndotl);
+ gl_FragColor = vec4(lit, band);
+ }
+`;
+
+function createScanlineMaterial(lightDirection: THREE.Vector3) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uStripeScale: { value: 16.0 },
+ },
+ vertexShader: scanlineVertexShader,
+ fragmentShader: scanlineFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyScanlineMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createScanlineMaterial(lightDirection);
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.planProMeshRest = rest;
+ });
+}
+
+export function Pro() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const readSize = () => {
+ const nextWidth = container.clientWidth;
+ const nextHeight = container.clientHeight;
+ return {
+ width: Math.max(nextWidth, 1),
+ height: Math.max(nextHeight, 1),
+ };
+ };
+
+ const { width, height } = readSize();
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.cursor = 'default';
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.35 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ applyScanlineMaterials(modelRoot, lightDirectionWorld);
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const influence = pointer.inside ? 1 : 0.22;
+ targetRotation.y = pointer.x * 0.52 * influence;
+ targetRotation.x = pointer.y * 0.42 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ 8.2,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ 8.2,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.06, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.22);
+ const my = pointer.y * (pointer.inside ? 1 : 0.22);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.planProMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 0.55 : 0.22;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.12 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.1 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.03 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.18 + my * 0.14) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const syncCanvasToContainer = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+ };
+
+ const resizeObserver = new ResizeObserver(() => {
+ syncCanvasToContainer();
+ });
+ resizeObserver.observe(container);
+
+ const handleWindowResize = () => {
+ syncCanvasToContainer();
+ };
+
+ window.addEventListener('resize', handleWindowResize);
+
+ return () => {
+ cancelled = true;
+ resizeObserver.disconnect();
+ window.removeEventListener('resize', handleWindowResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return (
+ <div
+ aria-hidden
+ ref={mountReference}
+ style={{
+ display: 'block',
+ height: '100%',
+ minWidth: 0,
+ width: '100%',
+ }}
+ />
+ );
+}
diff --git a/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCardVisual.tsx b/packages/twenty-website-new/src/illustrations/Quote/Quotes.tsx
similarity index 91%
rename from packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCardVisual.tsx
rename to packages/twenty-website-new/src/illustrations/Quote/Quotes.tsx
index 8f185c99800..046ea7a6ecb 100644
--- a/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCardVisual.tsx
+++ b/packages/twenty-website-new/src/illustrations/Quote/Quotes.tsx
@@ -1,10 +1,13 @@
'use client';
+import { theme } from '@/theme';
import { styled } from '@linaria/react';
-import { useEffect, useRef } from 'react';
+import { useLayoutEffect, useRef } from 'react';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+const GLB_URL = '/illustrations/why-twenty/quote/quote.glb';
+
const scanlineVertexShader = /* glsl */ `
varying vec3 vWorldPosition;
varying vec3 vWorldNormal;
@@ -117,29 +120,38 @@ function applyScanlineMaterials(
quaternion: mesh.quaternion.clone(),
wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
};
- mesh.userData.illustrationCardVisualRest = rest;
+ mesh.userData.quoteVisualRest = rest;
});
}
-const StyledVisualMount = styled.div`
+const VisualContainer = styled.div`
+ background-color: transparent;
+ border-radius: ${theme.radius(1)};
+ height: min(544px, 70vw);
+ min-height: ${theme.spacing(80)};
+ overflow: hidden;
+ position: relative;
+ width: 100%;
+
+ @media (min-width: ${theme.breakpoints.md}px) {
+ height: 544px;
+ max-width: 646px;
+ }
+`;
+
+const CanvasMount = styled.div`
display: block;
height: 100%;
+ inset: 0;
min-width: 0;
+ position: absolute;
width: 100%;
`;
-export type IllustrationCardVisualProps = {
- src: string;
- title: string;
-};
-
-export function IllustrationCardVisual({
- src,
- title,
-}: IllustrationCardVisualProps) {
+export function Quotes() {
const mountReference = useRef<HTMLDivElement>(null);
- useEffect(() => {
+ useLayoutEffect(() => {
const container = mountReference.current;
if (!container) {
return;
@@ -165,11 +177,11 @@ export function IllustrationCardVisual({
renderer.setClearColor(0x000000, 0);
renderer.outputColorSpace = THREE.SRGBColorSpace;
const canvas = renderer.domElement;
+ canvas.style.cursor = 'pointer';
canvas.style.display = 'block';
canvas.style.height = '100%';
canvas.style.touchAction = 'none';
canvas.style.width = '100%';
- canvas.style.cursor = 'pointer';
container.appendChild(canvas);
const pivot = new THREE.Group();
@@ -179,7 +191,7 @@ export function IllustrationCardVisual({
const loader = new GLTFLoader();
loader.load(
- src,
+ GLB_URL,
(gltf) => {
if (cancelled) {
disposeObjectSubtree(gltf.scene);
@@ -191,7 +203,7 @@ export function IllustrationCardVisual({
const center = bounds.getCenter(new THREE.Vector3());
const size = bounds.getSize(new THREE.Vector3());
const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
- const scale = 2.75 / maxAxis;
+ const scale = 3.05 / maxAxis;
modelRoot.position.sub(center);
modelRoot.scale.setScalar(scale);
@@ -238,7 +250,7 @@ export function IllustrationCardVisual({
return;
}
- const rest = sceneObject.userData.illustrationCardVisualRest as
+ const rest = sceneObject.userData.quoteVisualRest as
| MeshRestPose
| undefined;
if (!rest) {
@@ -322,9 +334,11 @@ export function IllustrationCardVisual({
container.removeChild(canvas);
}
};
- }, [src]);
+ }, []);
return (
- <StyledVisualMount aria-label={title} ref={mountReference} role="img" />
+ <VisualContainer>
+ <CanvasMount aria-hidden ref={mountReference} />
+ </VisualContainer>
);
}
diff --git a/packages/twenty-website-new/src/sections/Testimonials/components/HomeVisual/HomeVisual.tsx b/packages/twenty-website-new/src/illustrations/Testimonials/Hourglass.tsx
similarity index 93%
rename from packages/twenty-website-new/src/sections/Testimonials/components/HomeVisual/HomeVisual.tsx
rename to packages/twenty-website-new/src/illustrations/Testimonials/Hourglass.tsx
index 034c2d9212d..b3dffcb332c 100644
--- a/packages/twenty-website-new/src/sections/Testimonials/components/HomeVisual/HomeVisual.tsx
+++ b/packages/twenty-website-new/src/illustrations/Testimonials/Hourglass.tsx
@@ -6,10 +6,7 @@ import { useLayoutEffect, useRef } from 'react';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-const HOME_TESTIMONIALS_VISUAL_GLB_URL =
- '/illustrations/home/testimonials/testimonials.glb';
-const HOME_TESTIMONIALS_VISUAL_TITLE = 'Testimonials illustration';
-const HOME_TESTIMONIALS_VISUAL_MODEL_FIT_SCALE = 2.85;
+const GLB_URL = '/illustrations/home/testimonials/hourglass.glb';
const scanlineVertexShader = /* glsl */ `
varying vec3 vWorldPosition;
@@ -123,7 +120,7 @@ function applyScanlineMaterials(
quaternion: mesh.quaternion.clone(),
wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
};
- mesh.userData.homeTestimonialsVisualRest = rest;
+ mesh.userData.hourglassVisualRest = rest;
});
}
@@ -150,7 +147,7 @@ const CanvasMount = styled.div`
width: 100%;
`;
-export function HomeVisual() {
+export function Hourglass() {
const mountReference = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
@@ -193,7 +190,7 @@ export function HomeVisual() {
const loader = new GLTFLoader();
loader.load(
- HOME_TESTIMONIALS_VISUAL_GLB_URL,
+ GLB_URL,
(gltf) => {
if (cancelled) {
disposeObjectSubtree(gltf.scene);
@@ -205,7 +202,7 @@ export function HomeVisual() {
const center = bounds.getCenter(new THREE.Vector3());
const size = bounds.getSize(new THREE.Vector3());
const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
- const scale = HOME_TESTIMONIALS_VISUAL_MODEL_FIT_SCALE / maxAxis;
+ const scale = 2.85 / maxAxis;
modelRoot.position.sub(center);
modelRoot.scale.setScalar(scale);
@@ -252,7 +249,7 @@ export function HomeVisual() {
return;
}
- const rest = sceneObject.userData.homeTestimonialsVisualRest as
+ const rest = sceneObject.userData.hourglassVisualRest as
| MeshRestPose
| undefined;
if (!rest) {
@@ -315,6 +312,10 @@ export function HomeVisual() {
const nextWidth = mountReference.current.clientWidth;
const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
camera.aspect = nextWidth / nextHeight;
camera.updateProjectionMatrix();
renderer.setSize(nextWidth, nextHeight);
@@ -340,11 +341,7 @@ export function HomeVisual() {
return (
<VisualFrame>
- <CanvasMount
- aria-label={HOME_TESTIMONIALS_VISUAL_TITLE}
- ref={mountReference}
- role="img"
- />
+ <CanvasMount aria-hidden ref={mountReference} />
</VisualFrame>
);
}
diff --git a/packages/twenty-website-new/src/sections/Testimonials/components/PartnerVisual/PartnerVisual.tsx b/packages/twenty-website-new/src/illustrations/Testimonials/Partner.tsx
similarity index 94%
rename from packages/twenty-website-new/src/sections/Testimonials/components/PartnerVisual/PartnerVisual.tsx
rename to packages/twenty-website-new/src/illustrations/Testimonials/Partner.tsx
index 7540dc5460b..cda85c202ed 100644
--- a/packages/twenty-website-new/src/sections/Testimonials/components/PartnerVisual/PartnerVisual.tsx
+++ b/packages/twenty-website-new/src/illustrations/Testimonials/Partner.tsx
@@ -6,10 +6,7 @@ import { useLayoutEffect, useRef } from 'react';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-const PARTNER_TESTIMONIALS_VISUAL_GLB_URL =
- '/illustrations/partner/testimonials/testimonials.glb';
-const PARTNER_TESTIMONIALS_VISUAL_TITLE = 'Partner testimonials illustration';
-const PARTNER_TESTIMONIALS_VISUAL_MODEL_FIT_SCALE = 2.85;
+const GLB_URL = '/illustrations/partner/testimonials/quote.glb';
const scanlineVertexShader = /* glsl */ `
varying vec3 vWorldPosition;
@@ -150,7 +147,7 @@ const CanvasMount = styled.div`
width: 100%;
`;
-export function PartnerVisual() {
+export function Partner() {
const mountReference = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
@@ -193,7 +190,7 @@ export function PartnerVisual() {
const loader = new GLTFLoader();
loader.load(
- PARTNER_TESTIMONIALS_VISUAL_GLB_URL,
+ GLB_URL,
(gltf) => {
if (cancelled) {
disposeObjectSubtree(gltf.scene);
@@ -205,7 +202,7 @@ export function PartnerVisual() {
const center = bounds.getCenter(new THREE.Vector3());
const size = bounds.getSize(new THREE.Vector3());
const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
- const scale = PARTNER_TESTIMONIALS_VISUAL_MODEL_FIT_SCALE / maxAxis;
+ const scale = 2.85 / maxAxis;
modelRoot.position.sub(center);
modelRoot.scale.setScalar(scale);
@@ -340,11 +337,7 @@ export function PartnerVisual() {
return (
<VisualFrame>
- <CanvasMount
- aria-label={PARTNER_TESTIMONIALS_VISUAL_TITLE}
- ref={mountReference}
- role="img"
- />
+ <CanvasMount aria-hidden ref={mountReference} />
</VisualFrame>
);
}
diff --git a/packages/twenty-website-new/src/illustrations/ThreeCards/Connect.tsx b/packages/twenty-website-new/src/illustrations/ThreeCards/Connect.tsx
new file mode 100644
index 00000000000..3fc49eb0278
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/ThreeCards/Connect.tsx
@@ -0,0 +1,357 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/partner/three-cards/connect.glb';
+
+const halftoneVertexShader = /* glsl */ `
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const halftoneFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform vec2 uResolution;
+ uniform float uNumRows;
+
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.0);
+ float lum = mix(0.35, 1.0, ndotl);
+
+ float rowH = uResolution.y / uNumRows;
+ float rowFrac = gl_FragCoord.y / rowH - floor(gl_FragCoord.y / rowH);
+ float dy = abs(rowFrac - 0.5);
+
+ float cellW = rowH * 2.2;
+ float cellFrac = (gl_FragCoord.x - floor(gl_FragCoord.x / cellW) * cellW) / cellW;
+
+ float fill = pow(lum, 0.45) * 0.95;
+
+ float dynamicBarHalf = mix(0.15, 0.34, smoothstep(0.05, 0.8, lum));
+
+ float dx2 = abs(cellFrac - 0.5);
+ float halfFill = fill * 0.5;
+ float bodyHalfW = max(halfFill - dynamicBarHalf * (rowH / cellW), 0.0);
+ float capR = dynamicBarHalf * rowH;
+
+ float inDash = 0.0;
+ if (dx2 <= bodyHalfW) {
+ float edgeDist = dynamicBarHalf - dy;
+ inDash = smoothstep(-0.03, 0.03, edgeDist);
+ } else {
+ float cdx = (dx2 - bodyHalfW) * cellW;
+ float cdy = dy * rowH;
+ float d = sqrt(cdx * cdx + cdy * cdy);
+ inDash = 1.0 - smoothstep(capR - 1.5, capR + 1.5, d);
+ }
+
+ if (inDash < 0.01) {
+ discard;
+ }
+
+ gl_FragColor = vec4(uColor, inDash);
+ }
+`;
+
+function createHalftoneDashMaterial(
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uResolution: { value: resolution.clone() },
+ uNumRows: { value: 65 },
+ },
+ vertexShader: halftoneVertexShader,
+ fragmentShader: halftoneFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyHalftoneDashMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createHalftoneDashMaterial(
+ lightDirection,
+ resolution,
+ );
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.partnerCommunityMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Connect() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
+ renderer.setPixelRatio(1);
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.75 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ const canvasResolution = new THREE.Vector2(
+ renderer.domElement.width,
+ renderer.domElement.height,
+ );
+ applyHalftoneDashMaterials(
+ modelRoot,
+ lightDirectionWorld,
+ canvasResolution,
+ );
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * influence;
+ targetRotation.x = pointer.y * 0.62 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.32);
+ const my = pointer.y * (pointer.inside ? 1 : 0.32);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.partnerCommunityMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 1 : 0.36;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+
+ const rw = renderer.domElement.width;
+ const rh = renderer.domElement.height;
+ pivot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uResolution
+ ) {
+ sceneObject.material.uniforms.uResolution.value.set(rw, rh);
+ }
+ });
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/ThreeCards/Diamond.tsx b/packages/twenty-website-new/src/illustrations/ThreeCards/Diamond.tsx
new file mode 100644
index 00000000000..42cda6523da
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/ThreeCards/Diamond.tsx
@@ -0,0 +1,357 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/home/three-cards/diamond.glb';
+
+const halftoneVertexShader = /* glsl */ `
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const halftoneFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform vec2 uResolution;
+ uniform float uNumRows;
+
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.0);
+ float lum = mix(0.35, 1.0, ndotl);
+
+ float rowH = uResolution.y / uNumRows;
+ float rowFrac = gl_FragCoord.y / rowH - floor(gl_FragCoord.y / rowH);
+ float dy = abs(rowFrac - 0.5);
+
+ float cellW = rowH * 2.2;
+ float cellFrac = (gl_FragCoord.x - floor(gl_FragCoord.x / cellW) * cellW) / cellW;
+
+ float fill = pow(lum, 0.45) * 0.95;
+
+ float dynamicBarHalf = mix(0.15, 0.34, smoothstep(0.05, 0.8, lum));
+
+ float dx2 = abs(cellFrac - 0.5);
+ float halfFill = fill * 0.5;
+ float bodyHalfW = max(halfFill - dynamicBarHalf * (rowH / cellW), 0.0);
+ float capR = dynamicBarHalf * rowH;
+
+ float inDash = 0.0;
+ if (dx2 <= bodyHalfW) {
+ float edgeDist = dynamicBarHalf - dy;
+ inDash = smoothstep(-0.03, 0.03, edgeDist);
+ } else {
+ float cdx = (dx2 - bodyHalfW) * cellW;
+ float cdy = dy * rowH;
+ float d = sqrt(cdx * cdx + cdy * cdy);
+ inDash = 1.0 - smoothstep(capR - 1.5, capR + 1.5, d);
+ }
+
+ if (inDash < 0.01) {
+ discard;
+ }
+
+ gl_FragColor = vec4(uColor, inDash);
+ }
+`;
+
+function createHalftoneDashMaterial(
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uResolution: { value: resolution.clone() },
+ uNumRows: { value: 65 },
+ },
+ vertexShader: halftoneVertexShader,
+ fragmentShader: halftoneFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyHalftoneDashMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createHalftoneDashMaterial(
+ lightDirection,
+ resolution,
+ );
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.diamondMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Diamond() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
+ renderer.setPixelRatio(1);
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.75 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ const canvasResolution = new THREE.Vector2(
+ renderer.domElement.width,
+ renderer.domElement.height,
+ );
+ applyHalftoneDashMaterials(
+ modelRoot,
+ lightDirectionWorld,
+ canvasResolution,
+ );
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * influence;
+ targetRotation.x = pointer.y * 0.62 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.32);
+ const my = pointer.y * (pointer.inside ? 1 : 0.32);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.diamondMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 1 : 0.36;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+
+ const rw = renderer.domElement.width;
+ const rh = renderer.domElement.height;
+ pivot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uResolution
+ ) {
+ sceneObject.material.uniforms.uResolution.value.set(rw, rh);
+ }
+ });
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/ThreeCards/Eye.tsx b/packages/twenty-website-new/src/illustrations/ThreeCards/Eye.tsx
new file mode 100644
index 00000000000..9f1133d4474
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/ThreeCards/Eye.tsx
@@ -0,0 +1,357 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/product/three-cards/eye.glb';
+
+const halftoneVertexShader = /* glsl */ `
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const halftoneFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform vec2 uResolution;
+ uniform float uNumRows;
+
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.0);
+ float lum = mix(0.35, 1.0, ndotl);
+
+ float rowH = uResolution.y / uNumRows;
+ float rowFrac = gl_FragCoord.y / rowH - floor(gl_FragCoord.y / rowH);
+ float dy = abs(rowFrac - 0.5);
+
+ float cellW = rowH * 2.2;
+ float cellFrac = (gl_FragCoord.x - floor(gl_FragCoord.x / cellW) * cellW) / cellW;
+
+ float fill = pow(lum, 0.45) * 0.95;
+
+ float dynamicBarHalf = mix(0.15, 0.34, smoothstep(0.05, 0.8, lum));
+
+ float dx2 = abs(cellFrac - 0.5);
+ float halfFill = fill * 0.5;
+ float bodyHalfW = max(halfFill - dynamicBarHalf * (rowH / cellW), 0.0);
+ float capR = dynamicBarHalf * rowH;
+
+ float inDash = 0.0;
+ if (dx2 <= bodyHalfW) {
+ float edgeDist = dynamicBarHalf - dy;
+ inDash = smoothstep(-0.03, 0.03, edgeDist);
+ } else {
+ float cdx = (dx2 - bodyHalfW) * cellW;
+ float cdy = dy * rowH;
+ float d = sqrt(cdx * cdx + cdy * cdy);
+ inDash = 1.0 - smoothstep(capR - 1.5, capR + 1.5, d);
+ }
+
+ if (inDash < 0.01) {
+ discard;
+ }
+
+ gl_FragColor = vec4(uColor, inDash);
+ }
+`;
+
+function createHalftoneDashMaterial(
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uResolution: { value: resolution.clone() },
+ uNumRows: { value: 65 },
+ },
+ vertexShader: halftoneVertexShader,
+ fragmentShader: halftoneFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyHalftoneDashMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createHalftoneDashMaterial(
+ lightDirection,
+ resolution,
+ );
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.eyeMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Eye() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
+ renderer.setPixelRatio(1);
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.75 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ const canvasResolution = new THREE.Vector2(
+ renderer.domElement.width,
+ renderer.domElement.height,
+ );
+ applyHalftoneDashMaterials(
+ modelRoot,
+ lightDirectionWorld,
+ canvasResolution,
+ );
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * influence;
+ targetRotation.x = pointer.y * 0.62 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.32);
+ const my = pointer.y * (pointer.inside ? 1 : 0.32);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.eyeMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 1 : 0.36;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+
+ const rw = renderer.domElement.width;
+ const rh = renderer.domElement.height;
+ pivot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uResolution
+ ) {
+ sceneObject.material.uniforms.uResolution.value.set(rw, rh);
+ }
+ });
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/ThreeCards/Flash.tsx b/packages/twenty-website-new/src/illustrations/ThreeCards/Flash.tsx
new file mode 100644
index 00000000000..b6d02c96329
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/ThreeCards/Flash.tsx
@@ -0,0 +1,357 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/home/three-cards/flash.glb';
+
+const halftoneVertexShader = /* glsl */ `
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const halftoneFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform vec2 uResolution;
+ uniform float uNumRows;
+
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.0);
+ float lum = mix(0.35, 1.0, ndotl);
+
+ float rowH = uResolution.y / uNumRows;
+ float rowFrac = gl_FragCoord.y / rowH - floor(gl_FragCoord.y / rowH);
+ float dy = abs(rowFrac - 0.5);
+
+ float cellW = rowH * 2.2;
+ float cellFrac = (gl_FragCoord.x - floor(gl_FragCoord.x / cellW) * cellW) / cellW;
+
+ float fill = pow(lum, 0.45) * 0.95;
+
+ float dynamicBarHalf = mix(0.15, 0.34, smoothstep(0.05, 0.8, lum));
+
+ float dx2 = abs(cellFrac - 0.5);
+ float halfFill = fill * 0.5;
+ float bodyHalfW = max(halfFill - dynamicBarHalf * (rowH / cellW), 0.0);
+ float capR = dynamicBarHalf * rowH;
+
+ float inDash = 0.0;
+ if (dx2 <= bodyHalfW) {
+ float edgeDist = dynamicBarHalf - dy;
+ inDash = smoothstep(-0.03, 0.03, edgeDist);
+ } else {
+ float cdx = (dx2 - bodyHalfW) * cellW;
+ float cdy = dy * rowH;
+ float d = sqrt(cdx * cdx + cdy * cdy);
+ inDash = 1.0 - smoothstep(capR - 1.5, capR + 1.5, d);
+ }
+
+ if (inDash < 0.01) {
+ discard;
+ }
+
+ gl_FragColor = vec4(uColor, inDash);
+ }
+`;
+
+function createHalftoneDashMaterial(
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uResolution: { value: resolution.clone() },
+ uNumRows: { value: 65 },
+ },
+ vertexShader: halftoneVertexShader,
+ fragmentShader: halftoneFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyHalftoneDashMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createHalftoneDashMaterial(
+ lightDirection,
+ resolution,
+ );
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.flashMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Flash() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
+ renderer.setPixelRatio(1);
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.75 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ const canvasResolution = new THREE.Vector2(
+ renderer.domElement.width,
+ renderer.domElement.height,
+ );
+ applyHalftoneDashMaterials(
+ modelRoot,
+ lightDirectionWorld,
+ canvasResolution,
+ );
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * influence;
+ targetRotation.x = pointer.y * 0.62 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.32);
+ const my = pointer.y * (pointer.inside ? 1 : 0.32);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.flashMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 1 : 0.36;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+
+ const rw = renderer.domElement.width;
+ const rh = renderer.domElement.height;
+ pivot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uResolution
+ ) {
+ sceneObject.material.uniforms.uResolution.value.set(rw, rh);
+ }
+ });
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/ThreeCards/Grow.tsx b/packages/twenty-website-new/src/illustrations/ThreeCards/Grow.tsx
new file mode 100644
index 00000000000..3b6ef2b3eef
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/ThreeCards/Grow.tsx
@@ -0,0 +1,357 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/partner/three-cards/grow.glb';
+
+const halftoneVertexShader = /* glsl */ `
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const halftoneFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform vec2 uResolution;
+ uniform float uNumRows;
+
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.0);
+ float lum = mix(0.35, 1.0, ndotl);
+
+ float rowH = uResolution.y / uNumRows;
+ float rowFrac = gl_FragCoord.y / rowH - floor(gl_FragCoord.y / rowH);
+ float dy = abs(rowFrac - 0.5);
+
+ float cellW = rowH * 2.2;
+ float cellFrac = (gl_FragCoord.x - floor(gl_FragCoord.x / cellW) * cellW) / cellW;
+
+ float fill = pow(lum, 0.45) * 0.95;
+
+ float dynamicBarHalf = mix(0.15, 0.34, smoothstep(0.05, 0.8, lum));
+
+ float dx2 = abs(cellFrac - 0.5);
+ float halfFill = fill * 0.5;
+ float bodyHalfW = max(halfFill - dynamicBarHalf * (rowH / cellW), 0.0);
+ float capR = dynamicBarHalf * rowH;
+
+ float inDash = 0.0;
+ if (dx2 <= bodyHalfW) {
+ float edgeDist = dynamicBarHalf - dy;
+ inDash = smoothstep(-0.03, 0.03, edgeDist);
+ } else {
+ float cdx = (dx2 - bodyHalfW) * cellW;
+ float cdy = dy * rowH;
+ float d = sqrt(cdx * cdx + cdy * cdy);
+ inDash = 1.0 - smoothstep(capR - 1.5, capR + 1.5, d);
+ }
+
+ if (inDash < 0.01) {
+ discard;
+ }
+
+ gl_FragColor = vec4(uColor, inDash);
+ }
+`;
+
+function createHalftoneDashMaterial(
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uResolution: { value: resolution.clone() },
+ uNumRows: { value: 65 },
+ },
+ vertexShader: halftoneVertexShader,
+ fragmentShader: halftoneFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyHalftoneDashMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createHalftoneDashMaterial(
+ lightDirection,
+ resolution,
+ );
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.partnerSolutionsMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Grow() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
+ renderer.setPixelRatio(1);
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.75 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ const canvasResolution = new THREE.Vector2(
+ renderer.domElement.width,
+ renderer.domElement.height,
+ );
+ applyHalftoneDashMaterials(
+ modelRoot,
+ lightDirectionWorld,
+ canvasResolution,
+ );
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * influence;
+ targetRotation.x = pointer.y * 0.62 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.32);
+ const my = pointer.y * (pointer.inside ? 1 : 0.32);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.partnerSolutionsMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 1 : 0.36;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+
+ const rw = renderer.domElement.width;
+ const rh = renderer.domElement.height;
+ pivot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uResolution
+ ) {
+ sceneObject.material.uniforms.uResolution.value.set(rw, rh);
+ }
+ });
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/ThreeCards/Lock.tsx b/packages/twenty-website-new/src/illustrations/ThreeCards/Lock.tsx
new file mode 100644
index 00000000000..a0bffcbdf12
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/ThreeCards/Lock.tsx
@@ -0,0 +1,357 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/home/three-cards/lock.glb';
+
+const halftoneVertexShader = /* glsl */ `
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const halftoneFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform vec2 uResolution;
+ uniform float uNumRows;
+
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.0);
+ float lum = mix(0.35, 1.0, ndotl);
+
+ float rowH = uResolution.y / uNumRows;
+ float rowFrac = gl_FragCoord.y / rowH - floor(gl_FragCoord.y / rowH);
+ float dy = abs(rowFrac - 0.5);
+
+ float cellW = rowH * 2.2;
+ float cellFrac = (gl_FragCoord.x - floor(gl_FragCoord.x / cellW) * cellW) / cellW;
+
+ float fill = pow(lum, 0.45) * 0.95;
+
+ float dynamicBarHalf = mix(0.15, 0.34, smoothstep(0.05, 0.8, lum));
+
+ float dx2 = abs(cellFrac - 0.5);
+ float halfFill = fill * 0.5;
+ float bodyHalfW = max(halfFill - dynamicBarHalf * (rowH / cellW), 0.0);
+ float capR = dynamicBarHalf * rowH;
+
+ float inDash = 0.0;
+ if (dx2 <= bodyHalfW) {
+ float edgeDist = dynamicBarHalf - dy;
+ inDash = smoothstep(-0.03, 0.03, edgeDist);
+ } else {
+ float cdx = (dx2 - bodyHalfW) * cellW;
+ float cdy = dy * rowH;
+ float d = sqrt(cdx * cdx + cdy * cdy);
+ inDash = 1.0 - smoothstep(capR - 1.5, capR + 1.5, d);
+ }
+
+ if (inDash < 0.01) {
+ discard;
+ }
+
+ gl_FragColor = vec4(uColor, inDash);
+ }
+`;
+
+function createHalftoneDashMaterial(
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uResolution: { value: resolution.clone() },
+ uNumRows: { value: 65 },
+ },
+ vertexShader: halftoneVertexShader,
+ fragmentShader: halftoneFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyHalftoneDashMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createHalftoneDashMaterial(
+ lightDirection,
+ resolution,
+ );
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.lockMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Lock() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
+ renderer.setPixelRatio(1);
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.75 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ const canvasResolution = new THREE.Vector2(
+ renderer.domElement.width,
+ renderer.domElement.height,
+ );
+ applyHalftoneDashMaterials(
+ modelRoot,
+ lightDirectionWorld,
+ canvasResolution,
+ );
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * influence;
+ targetRotation.x = pointer.y * 0.62 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.32);
+ const my = pointer.y * (pointer.inside ? 1 : 0.32);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.lockMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 1 : 0.36;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+
+ const rw = renderer.domElement.width;
+ const rh = renderer.domElement.height;
+ pivot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uResolution
+ ) {
+ sceneObject.material.uniforms.uResolution.value.set(rw, rh);
+ }
+ });
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/ThreeCards/Programming.tsx b/packages/twenty-website-new/src/illustrations/ThreeCards/Programming.tsx
new file mode 100644
index 00000000000..2879a16d109
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/ThreeCards/Programming.tsx
@@ -0,0 +1,357 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/partner/three-cards/programming.glb';
+
+const halftoneVertexShader = /* glsl */ `
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const halftoneFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform vec2 uResolution;
+ uniform float uNumRows;
+
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.0);
+ float lum = mix(0.35, 1.0, ndotl);
+
+ float rowH = uResolution.y / uNumRows;
+ float rowFrac = gl_FragCoord.y / rowH - floor(gl_FragCoord.y / rowH);
+ float dy = abs(rowFrac - 0.5);
+
+ float cellW = rowH * 2.2;
+ float cellFrac = (gl_FragCoord.x - floor(gl_FragCoord.x / cellW) * cellW) / cellW;
+
+ float fill = pow(lum, 0.45) * 0.95;
+
+ float dynamicBarHalf = mix(0.15, 0.34, smoothstep(0.05, 0.8, lum));
+
+ float dx2 = abs(cellFrac - 0.5);
+ float halfFill = fill * 0.5;
+ float bodyHalfW = max(halfFill - dynamicBarHalf * (rowH / cellW), 0.0);
+ float capR = dynamicBarHalf * rowH;
+
+ float inDash = 0.0;
+ if (dx2 <= bodyHalfW) {
+ float edgeDist = dynamicBarHalf - dy;
+ inDash = smoothstep(-0.03, 0.03, edgeDist);
+ } else {
+ float cdx = (dx2 - bodyHalfW) * cellW;
+ float cdy = dy * rowH;
+ float d = sqrt(cdx * cdx + cdy * cdy);
+ inDash = 1.0 - smoothstep(capR - 1.5, capR + 1.5, d);
+ }
+
+ if (inDash < 0.01) {
+ discard;
+ }
+
+ gl_FragColor = vec4(uColor, inDash);
+ }
+`;
+
+function createHalftoneDashMaterial(
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uResolution: { value: resolution.clone() },
+ uNumRows: { value: 65 },
+ },
+ vertexShader: halftoneVertexShader,
+ fragmentShader: halftoneFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyHalftoneDashMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createHalftoneDashMaterial(
+ lightDirection,
+ resolution,
+ );
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.partnerTechnologyMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Programming() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
+ renderer.setPixelRatio(1);
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.75 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ const canvasResolution = new THREE.Vector2(
+ renderer.domElement.width,
+ renderer.domElement.height,
+ );
+ applyHalftoneDashMaterials(
+ modelRoot,
+ lightDirectionWorld,
+ canvasResolution,
+ );
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * influence;
+ targetRotation.x = pointer.y * 0.62 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.32);
+ const my = pointer.y * (pointer.inside ? 1 : 0.32);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.partnerTechnologyMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 1 : 0.36;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+
+ const rw = renderer.domElement.width;
+ const rh = renderer.domElement.height;
+ pivot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uResolution
+ ) {
+ sceneObject.material.uniforms.uResolution.value.set(rw, rh);
+ }
+ });
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/ThreeCards/SingleScreen.tsx b/packages/twenty-website-new/src/illustrations/ThreeCards/SingleScreen.tsx
new file mode 100644
index 00000000000..c718ab58a16
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/ThreeCards/SingleScreen.tsx
@@ -0,0 +1,357 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/product/three-cards/single-screen.glb';
+
+const halftoneVertexShader = /* glsl */ `
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const halftoneFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform vec2 uResolution;
+ uniform float uNumRows;
+
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.0);
+ float lum = mix(0.35, 1.0, ndotl);
+
+ float rowH = uResolution.y / uNumRows;
+ float rowFrac = gl_FragCoord.y / rowH - floor(gl_FragCoord.y / rowH);
+ float dy = abs(rowFrac - 0.5);
+
+ float cellW = rowH * 2.2;
+ float cellFrac = (gl_FragCoord.x - floor(gl_FragCoord.x / cellW) * cellW) / cellW;
+
+ float fill = pow(lum, 0.45) * 0.95;
+
+ float dynamicBarHalf = mix(0.15, 0.34, smoothstep(0.05, 0.8, lum));
+
+ float dx2 = abs(cellFrac - 0.5);
+ float halfFill = fill * 0.5;
+ float bodyHalfW = max(halfFill - dynamicBarHalf * (rowH / cellW), 0.0);
+ float capR = dynamicBarHalf * rowH;
+
+ float inDash = 0.0;
+ if (dx2 <= bodyHalfW) {
+ float edgeDist = dynamicBarHalf - dy;
+ inDash = smoothstep(-0.03, 0.03, edgeDist);
+ } else {
+ float cdx = (dx2 - bodyHalfW) * cellW;
+ float cdy = dy * rowH;
+ float d = sqrt(cdx * cdx + cdy * cdy);
+ inDash = 1.0 - smoothstep(capR - 1.5, capR + 1.5, d);
+ }
+
+ if (inDash < 0.01) {
+ discard;
+ }
+
+ gl_FragColor = vec4(uColor, inDash);
+ }
+`;
+
+function createHalftoneDashMaterial(
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uResolution: { value: resolution.clone() },
+ uNumRows: { value: 65 },
+ },
+ vertexShader: halftoneVertexShader,
+ fragmentShader: halftoneFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyHalftoneDashMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createHalftoneDashMaterial(
+ lightDirection,
+ resolution,
+ );
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.singleScreenMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function SingleScreen() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
+ renderer.setPixelRatio(1);
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.75 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ const canvasResolution = new THREE.Vector2(
+ renderer.domElement.width,
+ renderer.domElement.height,
+ );
+ applyHalftoneDashMaterials(
+ modelRoot,
+ lightDirectionWorld,
+ canvasResolution,
+ );
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * influence;
+ targetRotation.x = pointer.y * 0.62 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.32);
+ const my = pointer.y * (pointer.inside ? 1 : 0.32);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.singleScreenMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 1 : 0.36;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+
+ const rw = renderer.domElement.width;
+ const rh = renderer.domElement.height;
+ pivot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uResolution
+ ) {
+ sceneObject.material.uniforms.uResolution.value.set(rw, rh);
+ }
+ });
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/ThreeCards/Speed.tsx b/packages/twenty-website-new/src/illustrations/ThreeCards/Speed.tsx
new file mode 100644
index 00000000000..1ed981026d0
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/ThreeCards/Speed.tsx
@@ -0,0 +1,357 @@
+'use client';
+
+import { styled } from '@linaria/react';
+import { useEffect, useRef } from 'react';
+import * as THREE from 'three';
+import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
+
+const GLB_URL = '/illustrations/product/three-cards/speed.glb';
+
+const halftoneVertexShader = /* glsl */ `
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ vWorldNormal = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const halftoneFragmentShader = /* glsl */ `
+ uniform vec3 uColor;
+ uniform vec3 uLightDir;
+ uniform vec2 uResolution;
+ uniform float uNumRows;
+
+ varying vec3 vWorldNormal;
+
+ void main() {
+ vec3 normal = normalize(vWorldNormal);
+ vec3 lightDir = normalize(uLightDir);
+ float ndotl = max(dot(normal, lightDir), 0.0);
+ float lum = mix(0.35, 1.0, ndotl);
+
+ float rowH = uResolution.y / uNumRows;
+ float rowFrac = gl_FragCoord.y / rowH - floor(gl_FragCoord.y / rowH);
+ float dy = abs(rowFrac - 0.5);
+
+ float cellW = rowH * 2.2;
+ float cellFrac = (gl_FragCoord.x - floor(gl_FragCoord.x / cellW) * cellW) / cellW;
+
+ float fill = pow(lum, 0.45) * 0.95;
+
+ float dynamicBarHalf = mix(0.15, 0.34, smoothstep(0.05, 0.8, lum));
+
+ float dx2 = abs(cellFrac - 0.5);
+ float halfFill = fill * 0.5;
+ float bodyHalfW = max(halfFill - dynamicBarHalf * (rowH / cellW), 0.0);
+ float capR = dynamicBarHalf * rowH;
+
+ float inDash = 0.0;
+ if (dx2 <= bodyHalfW) {
+ float edgeDist = dynamicBarHalf - dy;
+ inDash = smoothstep(-0.03, 0.03, edgeDist);
+ } else {
+ float cdx = (dx2 - bodyHalfW) * cellW;
+ float cdy = dy * rowH;
+ float d = sqrt(cdx * cdx + cdy * cdy);
+ inDash = 1.0 - smoothstep(capR - 1.5, capR + 1.5, d);
+ }
+
+ if (inDash < 0.01) {
+ discard;
+ }
+
+ gl_FragColor = vec4(uColor, inDash);
+ }
+`;
+
+function createHalftoneDashMaterial(
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ return new THREE.ShaderMaterial({
+ uniforms: {
+ uColor: { value: new THREE.Color('#1e5bff') },
+ uLightDir: { value: lightDirection.clone() },
+ uResolution: { value: resolution.clone() },
+ uNumRows: { value: 65 },
+ },
+ vertexShader: halftoneVertexShader,
+ fragmentShader: halftoneFragmentShader,
+ transparent: true,
+ depthWrite: true,
+ depthTest: true,
+ side: THREE.DoubleSide,
+ });
+}
+
+function disposeObjectSubtree(root: THREE.Object3D) {
+ root.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.geometry?.dispose();
+
+ const material = sceneObject.material;
+ if (Array.isArray(material)) {
+ material.forEach((item) => item.dispose());
+ } else {
+ material?.dispose();
+ }
+ });
+}
+
+type MeshRestPose = {
+ position: THREE.Vector3;
+ quaternion: THREE.Quaternion;
+ wobblePhase: number;
+};
+
+function applyHalftoneDashMaterials(
+ modelRoot: THREE.Object3D,
+ lightDirection: THREE.Vector3,
+ resolution: THREE.Vector2,
+) {
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ sceneObject.material = createHalftoneDashMaterial(
+ lightDirection,
+ resolution,
+ );
+
+ const mesh = sceneObject;
+ const rest: MeshRestPose = {
+ position: mesh.position.clone(),
+ quaternion: mesh.quaternion.clone(),
+ wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
+ };
+ mesh.userData.speedMeshRest = rest;
+ });
+}
+
+const StyledVisualMount = styled.div`
+ display: block;
+ height: 100%;
+ min-width: 0;
+ width: 100%;
+`;
+
+export function Speed() {
+ const mountReference = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const container = mountReference.current;
+ if (!container) {
+ return;
+ }
+
+ let cancelled = false;
+ let animationFrameId = 0;
+
+ const pointer = { x: 0, y: 0, inside: false };
+ const targetRotation = { x: 0, y: 0 };
+ const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
+
+ const scene = new THREE.Scene();
+ const width = container.clientWidth;
+ const height = container.clientHeight;
+
+ const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
+ camera.position.set(0, 0, 5.05);
+
+ const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
+ renderer.setPixelRatio(1);
+ renderer.setSize(width, height);
+ renderer.setClearColor(0x000000, 0);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ const canvas = renderer.domElement;
+ canvas.style.display = 'block';
+ canvas.style.height = '100%';
+ canvas.style.touchAction = 'none';
+ canvas.style.width = '100%';
+ canvas.style.cursor = 'pointer';
+ container.appendChild(canvas);
+
+ const pivot = new THREE.Group();
+ scene.add(pivot);
+
+ const clock = new THREE.Clock();
+
+ const loader = new GLTFLoader();
+ loader.load(
+ GLB_URL,
+ (gltf) => {
+ if (cancelled) {
+ disposeObjectSubtree(gltf.scene);
+ return;
+ }
+
+ const modelRoot = gltf.scene;
+ const bounds = new THREE.Box3().setFromObject(modelRoot);
+ const center = bounds.getCenter(new THREE.Vector3());
+ const size = bounds.getSize(new THREE.Vector3());
+ const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
+ const scale = 2.75 / maxAxis;
+
+ modelRoot.position.sub(center);
+ modelRoot.scale.setScalar(scale);
+
+ const canvasResolution = new THREE.Vector2(
+ renderer.domElement.width,
+ renderer.domElement.height,
+ );
+ applyHalftoneDashMaterials(
+ modelRoot,
+ lightDirectionWorld,
+ canvasResolution,
+ );
+ pivot.add(modelRoot);
+
+ const renderFrame = () => {
+ if (cancelled) {
+ return;
+ }
+
+ animationFrameId = window.requestAnimationFrame(renderFrame);
+ const delta = Math.min(clock.getDelta(), 0.1);
+
+ const rotationDamp = 6.8;
+ const influence = pointer.inside ? 1 : 0.38;
+ targetRotation.y = pointer.x * 0.78 * influence;
+ targetRotation.x = pointer.y * 0.62 * influence;
+
+ pivot.rotation.y = THREE.MathUtils.damp(
+ pivot.rotation.y,
+ targetRotation.y,
+ rotationDamp,
+ delta,
+ );
+ pivot.rotation.x = THREE.MathUtils.damp(
+ pivot.rotation.x,
+ targetRotation.x,
+ rotationDamp,
+ delta,
+ );
+
+ const hoverLift = pointer.inside ? 1 : 0;
+ pivot.scale.setScalar(
+ THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
+ );
+
+ const mx = pointer.x * (pointer.inside ? 1 : 0.32);
+ const my = pointer.y * (pointer.inside ? 1 : 0.32);
+
+ modelRoot.traverse((sceneObject) => {
+ if (!(sceneObject instanceof THREE.Mesh)) {
+ return;
+ }
+
+ const rest = sceneObject.userData.speedMeshRest as
+ | MeshRestPose
+ | undefined;
+ if (!rest) {
+ return;
+ }
+
+ const phase = rest.wobblePhase;
+ const wobble = pointer.inside ? 1 : 0.36;
+ sceneObject.position.x =
+ rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
+ sceneObject.position.z =
+ rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
+ sceneObject.position.y =
+ rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
+
+ const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
+ sceneObject.quaternion.copy(rest.quaternion);
+ sceneObject.rotateY(twist);
+ });
+
+ renderer.render(scene, camera);
+ };
+
+ renderFrame();
+ },
+ undefined,
+ undefined,
+ );
+
+ const setPointerFromEvent = (event: PointerEvent) => {
+ const rect = canvas.getBoundingClientRect();
+ const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
+ const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
+ pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
+ pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
+ };
+
+ const handlePointerEnter = () => {
+ pointer.inside = true;
+ };
+
+ const handlePointerLeave = () => {
+ pointer.inside = false;
+ pointer.x = 0;
+ pointer.y = 0;
+ };
+
+ const handlePointerMove = (event: PointerEvent) => {
+ setPointerFromEvent(event);
+ };
+
+ canvas.addEventListener('pointerenter', handlePointerEnter);
+ canvas.addEventListener('pointerleave', handlePointerLeave);
+ canvas.addEventListener('pointermove', handlePointerMove);
+
+ const handleResize = () => {
+ if (!mountReference.current || cancelled) {
+ return;
+ }
+
+ const nextWidth = mountReference.current.clientWidth;
+ const nextHeight = mountReference.current.clientHeight;
+ if (nextWidth < 1 || nextHeight < 1) {
+ return;
+ }
+
+ camera.aspect = nextWidth / nextHeight;
+ camera.updateProjectionMatrix();
+ renderer.setSize(nextWidth, nextHeight);
+
+ const rw = renderer.domElement.width;
+ const rh = renderer.domElement.height;
+ pivot.traverse((sceneObject) => {
+ if (
+ sceneObject instanceof THREE.Mesh &&
+ sceneObject.material instanceof THREE.ShaderMaterial &&
+ sceneObject.material.uniforms.uResolution
+ ) {
+ sceneObject.material.uniforms.uResolution.value.set(rw, rh);
+ }
+ });
+ };
+
+ window.addEventListener('resize', handleResize);
+
+ return () => {
+ cancelled = true;
+ window.removeEventListener('resize', handleResize);
+ canvas.removeEventListener('pointerenter', handlePointerEnter);
+ canvas.removeEventListener('pointerleave', handlePointerLeave);
+ canvas.removeEventListener('pointermove', handlePointerMove);
+ window.cancelAnimationFrame(animationFrameId);
+ disposeObjectSubtree(scene);
+ renderer.dispose();
+
+ if (canvas.parentNode === container) {
+ container.removeChild(canvas);
+ }
+ };
+ }, []);
+
+ return <StyledVisualMount aria-hidden ref={mountReference} />;
+}
diff --git a/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/Visual/Visual.tsx b/packages/twenty-website-new/src/illustrations/WhyTwentyStepper/Logo.tsx
similarity index 94%
rename from packages/twenty-website-new/src/sections/WhyTwentyStepper/components/Visual/Visual.tsx
rename to packages/twenty-website-new/src/illustrations/WhyTwentyStepper/Logo.tsx
index 4d76c676745..f39deb0ad8e 100644
--- a/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/Visual/Visual.tsx
+++ b/packages/twenty-website-new/src/illustrations/WhyTwentyStepper/Logo.tsx
@@ -1,14 +1,12 @@
'use client';
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
import { theme } from '@/theme';
import { styled } from '@linaria/react';
import { useLayoutEffect, useRef } from 'react';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-const STEP_VISUAL_MODEL_SCALE = 2.72;
-const STEP_VISUAL_STRIPE_SCALE = 22.0;
+const GLB_URL = '/illustrations/why-twenty/stepper/logo.glb';
const VisualColumn = styled.div`
min-width: 0;
@@ -138,7 +136,7 @@ function createRetroScreenStripeMaterial() {
uDigitCenterXY: { value: new THREE.Vector2(0, 0) },
uDigitRadiusXY: { value: new THREE.Vector2(1, 1) },
uDigitZMin: { value: 0 },
- uStripeScale: { value: STEP_VISUAL_STRIPE_SCALE },
+ uStripeScale: { value: 22.0 },
},
vertexShader: retroVertexShader,
fragmentShader: retroFragmentShader,
@@ -184,11 +182,7 @@ function applyRetroScreenStripeMaterials(modelRoot: THREE.Object3D) {
});
}
-type VisualProps = {
- illustration: IllustrationType;
-};
-
-export function Visual({ illustration }: VisualProps) {
+export function Logo() {
const glbMountReference = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
@@ -272,7 +266,7 @@ export function Visual({ illustration }: VisualProps) {
syncResolutionUniforms();
const loader = new GLTFLoader();
- loader.load(illustration.src, (gltf) => {
+ loader.load(GLB_URL, (gltf) => {
if (cancelled) {
disposeObjectSubtree(gltf.scene);
return;
@@ -284,7 +278,7 @@ export function Visual({ illustration }: VisualProps) {
const size = bounds.getSize(new THREE.Vector3());
const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
- const scale = STEP_VISUAL_MODEL_SCALE / maxAxis;
+ const scale = 2.72 / maxAxis;
modelRoot.position.sub(center);
modelRoot.scale.setScalar(scale);
@@ -364,16 +358,12 @@ export function Visual({ illustration }: VisualProps) {
container.removeChild(canvas);
}
};
- }, [illustration.src]);
+ }, []);
return (
<VisualColumn>
<VisualContainer>
- <GlbMount
- aria-label={illustration.title}
- ref={glbMountReference}
- role="img"
- />
+ <GlbMount aria-hidden ref={glbMountReference} />
</VisualContainer>
</VisualColumn>
);
diff --git a/packages/twenty-website-new/src/illustrations/illustration-mount.tsx b/packages/twenty-website-new/src/illustrations/illustration-mount.tsx
new file mode 100644
index 00000000000..02f7c2e5120
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/illustration-mount.tsx
@@ -0,0 +1,16 @@
+'use client';
+
+import {
+ ILLUSTRATIONS,
+ type IllustrationId,
+} from '@/illustrations/illustrations-registry';
+
+type IllustrationMountProps = {
+ illustration: IllustrationId;
+};
+
+export function IllustrationMount({ illustration }: IllustrationMountProps) {
+ const IllustrationComponent = ILLUSTRATIONS[illustration];
+
+ return <IllustrationComponent />;
+}
diff --git a/packages/twenty-website-new/src/illustrations/illustrations-registry.tsx b/packages/twenty-website-new/src/illustrations/illustrations-registry.tsx
new file mode 100644
index 00000000000..6eb4d031837
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/illustrations-registry.tsx
@@ -0,0 +1,58 @@
+'use client';
+
+import type { ComponentType } from 'react';
+import { FaqBackground } from './Faq/Background';
+import { FooterBackground } from './Footer/Background';
+import { Money } from './Helped/Money';
+import { Spaceship } from './Helped/Spaceship';
+import { Target } from './Helped/Target';
+import { Product } from './Hero/Product';
+import { WhyTwenty } from './Hero/WhyTwenty';
+import { Organization } from './Plans/Organization';
+import { Pro } from './Plans/Pro';
+import { Quotes } from './Quote/Quotes';
+import { Hourglass } from './Testimonials/Hourglass';
+import { Partner } from './Testimonials/Partner';
+import { Connect } from './ThreeCards/Connect';
+import { Diamond } from './ThreeCards/Diamond';
+import { Eye } from './ThreeCards/Eye';
+import { Flash } from './ThreeCards/Flash';
+import { Grow } from './ThreeCards/Grow';
+import { Lock } from './ThreeCards/Lock';
+import { Programming } from './ThreeCards/Programming';
+import { SingleScreen } from './ThreeCards/SingleScreen';
+import { Speed } from './ThreeCards/Speed';
+import { Logo as WhyTwentyStepperLogo } from './WhyTwentyStepper/Logo';
+
+export const THREE_CARDS_ILLUSTRATIONS = {
+ diamond: Diamond,
+ eye: Eye,
+ flash: Flash,
+ lock: Lock,
+ connect: Connect,
+ grow: Grow,
+ programming: Programming,
+ singleScreen: SingleScreen,
+ speed: Speed,
+} as const satisfies Record<string, ComponentType>;
+
+export type ThreeCardsIllustrationId = keyof typeof THREE_CARDS_ILLUSTRATIONS;
+
+export const ILLUSTRATIONS = {
+ ...THREE_CARDS_ILLUSTRATIONS,
+ faqBackground: FaqBackground,
+ footerBackground: FooterBackground,
+ quoteQuotes: Quotes,
+ whyTwentyStepperLogo: WhyTwentyStepperLogo,
+ heroProduct: Product,
+ heroWhyTwenty: WhyTwenty,
+ testimonialsPartner: Partner,
+ testimonialsHourglass: Hourglass,
+ planPro: Pro,
+ planOrganization: Organization,
+ money: Money,
+ spaceship: Spaceship,
+ target: Target,
+} as const satisfies Record<string, ComponentType>;
+
+export type IllustrationId = keyof typeof ILLUSTRATIONS;
diff --git a/packages/twenty-website-new/src/illustrations/index.ts b/packages/twenty-website-new/src/illustrations/index.ts
new file mode 100644
index 00000000000..85c1d8a5acc
--- /dev/null
+++ b/packages/twenty-website-new/src/illustrations/index.ts
@@ -0,0 +1,7 @@
+export { IllustrationMount } from './illustration-mount';
+export {
+ ILLUSTRATIONS,
+ THREE_CARDS_ILLUSTRATIONS,
+ type IllustrationId,
+ type ThreeCardsIllustrationId,
+} from './illustrations-registry';
diff --git a/packages/twenty-website-new/src/sections/Faq/components/Root/Root.tsx b/packages/twenty-website-new/src/sections/Faq/components/Root/Root.tsx
index d5391f6a215..ac5af5867ed 100644
--- a/packages/twenty-website-new/src/sections/Faq/components/Root/Root.tsx
+++ b/packages/twenty-website-new/src/sections/Faq/components/Root/Root.tsx
@@ -1,6 +1,5 @@
import { Container } from '@/design-system/components';
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
-import { FaqVisual } from '../FaqVisual/FaqVisual';
+import { IllustrationMount, type IllustrationId } from '@/illustrations';
import { theme } from '@/theme';
import { styled } from '@linaria/react';
import type { ReactNode } from 'react';
@@ -41,14 +40,14 @@ const StyledContainer = styled(Container)`
type RootProps = {
children: ReactNode;
- illustration: IllustrationType;
+ illustration: IllustrationId;
};
export function Root({ children, illustration }: RootProps) {
return (
<StyledSection>
<IllustrationLayer aria-hidden>
- <FaqVisual src={illustration.src} title={illustration.title} />
+ <IllustrationMount illustration={illustration} />
</IllustrationLayer>
<StyledContainer>{children}</StyledContainer>
</StyledSection>
diff --git a/packages/twenty-website-new/src/sections/Faq/types/FaqData.ts b/packages/twenty-website-new/src/sections/Faq/types/FaqData.ts
index d908145b9db..a120f2464fc 100644
--- a/packages/twenty-website-new/src/sections/Faq/types/FaqData.ts
+++ b/packages/twenty-website-new/src/sections/Faq/types/FaqData.ts
@@ -1,10 +1,10 @@
-import { EyebrowType } from '@/design-system/components/Eyebrow/types/Eyebrow';
-import { HeadingType } from '@/design-system/components/Heading/types/Heading';
-import { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
-import { FaqQuestionType } from '@/sections/Faq/types/FaqQuestion';
+import { type EyebrowType } from '@/design-system/components/Eyebrow/types/Eyebrow';
+import { type HeadingType } from '@/design-system/components/Heading/types/Heading';
+import type { IllustrationId } from '@/illustrations';
+import { type FaqQuestionType } from '@/sections/Faq/types/FaqQuestion';
export type FaqDataType = {
- illustration: IllustrationType;
+ illustration: IllustrationId;
eyebrow: EyebrowType;
heading: HeadingType[];
questions: FaqQuestionType[];
diff --git a/packages/twenty-website-new/src/sections/Footer/components/FooterBackground/FooterBackground.tsx b/packages/twenty-website-new/src/sections/Footer/components/FooterBackground/FooterBackground.tsx
deleted file mode 100644
index 4c88b0fbbed..00000000000
--- a/packages/twenty-website-new/src/sections/Footer/components/FooterBackground/FooterBackground.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-'use client';
-
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
-import dynamic from 'next/dynamic';
-import type { ComponentPropsWithoutRef } from 'react';
-
-const FooterBackgroundCanvas = dynamic(
- () =>
- import('./FooterBackgroundCanvas').then((mod) => ({
- default: mod.FooterBackgroundCanvas,
- })),
- { ssr: false },
-);
-
-type FooterBackgroundProps = {
- illustration: IllustrationType;
-} & Pick<ComponentPropsWithoutRef<'div'>, 'aria-hidden'>;
-
-export function FooterBackground({
- illustration,
- 'aria-hidden': ariaHidden,
-}: FooterBackgroundProps) {
- return (
- <FooterBackgroundCanvas
- aria-hidden={ariaHidden}
- illustration={illustration}
- />
- );
-}
diff --git a/packages/twenty-website-new/src/sections/Footer/components/FooterBackground/FooterBackgroundCanvas.tsx b/packages/twenty-website-new/src/sections/Footer/components/FooterBackground/FooterBackgroundCanvas.tsx
deleted file mode 100644
index 6d4fde06056..00000000000
--- a/packages/twenty-website-new/src/sections/Footer/components/FooterBackground/FooterBackgroundCanvas.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-'use client';
-
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
-import type { ComponentPropsWithoutRef } from 'react';
-import { FooterVisual } from '../FooterVisual/FooterVisual';
-import { FooterBackgroundCanvasRoot } from './FooterBackgroundCanvasRoot';
-
-type FooterBackgroundCanvasProps = {
- illustration: IllustrationType;
-} & Pick<ComponentPropsWithoutRef<'div'>, 'aria-hidden'>;
-
-export function FooterBackgroundCanvas({
- illustration,
- 'aria-hidden': ariaHidden,
-}: FooterBackgroundCanvasProps) {
- return (
- <FooterBackgroundCanvasRoot aria-hidden={ariaHidden}>
- <FooterVisual src={illustration.src} title={illustration.title} />
- </FooterBackgroundCanvasRoot>
- );
-}
diff --git a/packages/twenty-website-new/src/sections/Footer/components/FooterBackground/FooterBackgroundCanvasRoot.tsx b/packages/twenty-website-new/src/sections/Footer/components/FooterBackground/FooterBackgroundCanvasRoot.tsx
deleted file mode 100644
index 1195ea112df..00000000000
--- a/packages/twenty-website-new/src/sections/Footer/components/FooterBackground/FooterBackgroundCanvasRoot.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { styled } from '@linaria/react';
-
-export const FooterBackgroundCanvasRoot = styled.div`
- position: absolute;
- inset: 0;
- z-index: 0;
- pointer-events: none;
- overflow: hidden;
-
- & canvas {
- display: block;
- height: 100%;
- pointer-events: auto;
- width: 100%;
- }
-`;
diff --git a/packages/twenty-website-new/src/sections/Footer/components/Root/Root.tsx b/packages/twenty-website-new/src/sections/Footer/components/Root/Root.tsx
index 11626f1126a..2edc804acf5 100644
--- a/packages/twenty-website-new/src/sections/Footer/components/Root/Root.tsx
+++ b/packages/twenty-website-new/src/sections/Footer/components/Root/Root.tsx
@@ -1,10 +1,9 @@
import { Container } from '@/design-system/components';
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
+import { IllustrationMount, type IllustrationId } from '@/illustrations';
import { theme } from '@/theme';
import { styled } from '@linaria/react';
import type { ReactNode } from 'react';
import { FooterShape } from '../../FooterShape';
-import { FooterBackground } from '../FooterBackground/FooterBackground';
const FooterRoot = styled.footer`
background-color: ${theme.colors.secondary.background[100]};
@@ -50,14 +49,14 @@ const FooterContent = styled.div`
type RootProps = {
children: ReactNode;
- illustration: IllustrationType;
+ illustration: IllustrationId;
};
export function Root({ children, illustration }: RootProps) {
return (
<FooterRoot>
<FooterContainer>
- <FooterBackground aria-hidden illustration={illustration} />
+ <IllustrationMount illustration={illustration} />
<FooterContent>
<FooterShape fillColor={theme.colors.primary.background[100]} />
{children}
diff --git a/packages/twenty-website-new/src/sections/Footer/types/FooterData.ts b/packages/twenty-website-new/src/sections/Footer/types/FooterData.ts
index 62e41f0ddc2..85063d8b19a 100644
--- a/packages/twenty-website-new/src/sections/Footer/types/FooterData.ts
+++ b/packages/twenty-website-new/src/sections/Footer/types/FooterData.ts
@@ -1,11 +1,11 @@
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
+import type { IllustrationId } from '@/illustrations';
import type { FooterBottomType } from './FooterBottom';
import type { FooterNavGroupType } from './FooterNavGroup';
import type { FooterSocialLinkType } from './FooterSocialLink';
export type FooterDataType = {
bottom: FooterBottomType;
- illustration: IllustrationType;
+ illustration: IllustrationId;
navGroups: FooterNavGroupType[];
socialLinks: FooterSocialLinkType[];
};
diff --git a/packages/twenty-website-new/src/sections/Helped/components/Card/Card.tsx b/packages/twenty-website-new/src/sections/Helped/components/Card/Card.tsx
index 9175709dc22..d23af83346a 100644
--- a/packages/twenty-website-new/src/sections/Helped/components/Card/Card.tsx
+++ b/packages/twenty-website-new/src/sections/Helped/components/Card/Card.tsx
@@ -1,10 +1,10 @@
import { Body, Heading, LinkButton } from '@/design-system/components';
import { CLIENT_ICONS } from '@/icons';
+import { IllustrationMount } from '@/illustrations';
import { HelpedCardShape } from '@/sections/Helped/HelpedCardShape';
import type { HeadingCardType } from '@/sections/Helped/types/HeadingCard';
import { theme } from '@/theme';
import { styled } from '@linaria/react';
-import { HelpedCardVisual } from './HelpedCardVisual';
const CardRoot = styled.article`
display: grid;
@@ -93,11 +93,7 @@ export function Card({ card }: CardProps) {
</LogoRow>
<Rule aria-hidden="true" />
<VisualShell>
- <HelpedCardVisual
- src={card.illustration.src}
- stripeColor={card.illustration.color}
- title={card.illustration.title || 'Case illustration'}
- />
+ <IllustrationMount illustration={card.illustration} />
</VisualShell>
<Rule aria-hidden="true" />
<CopyBlock>
diff --git a/packages/twenty-website-new/src/sections/Helped/types/HeadingCard.ts b/packages/twenty-website-new/src/sections/Helped/types/HeadingCard.ts
index 7eac95565c5..85c6ffddd67 100644
--- a/packages/twenty-website-new/src/sections/Helped/types/HeadingCard.ts
+++ b/packages/twenty-website-new/src/sections/Helped/types/HeadingCard.ts
@@ -1,10 +1,10 @@
import type { BodyType } from '@/design-system/components/Body/types/Body';
import type { HeadingType } from '@/design-system/components/Heading/types/Heading';
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
+import type { IllustrationId } from '@/illustrations';
export type HeadingCardType = {
icon: string;
- illustration: IllustrationType & { color: string };
+ illustration: IllustrationId;
heading: HeadingType;
body: BodyType;
};
diff --git a/packages/twenty-website-new/src/sections/Hero/components/WhyTwentyVisual/WhyTwentyVisual.tsx b/packages/twenty-website-new/src/sections/Hero/components/WhyTwentyVisual/WhyTwentyVisual.tsx
index 31ed87df378..7d89cdc072b 100644
--- a/packages/twenty-website-new/src/sections/Hero/components/WhyTwentyVisual/WhyTwentyVisual.tsx
+++ b/packages/twenty-website-new/src/sections/Hero/components/WhyTwentyVisual/WhyTwentyVisual.tsx
@@ -1,15 +1,10 @@
'use client';
+import { WhyTwenty as WhyTwentyGlb } from '@/illustrations/Hero/WhyTwenty';
import { theme } from '@/theme';
import { css } from '@linaria/core';
import { styled } from '@linaria/react';
import NextImage from 'next/image';
-import { useEffect, useRef } from 'react';
-import * as THREE from 'three';
-import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-
-const HERO_BACKGROUND_SRC = '/images/why-twenty/hero/background.png';
-const HERO_GLB_URL = '/illustrations/why-twenty/hero/hero.glb';
const VisualContainer = styled.div`
border-radius: ${theme.radius(1)};
@@ -30,321 +25,7 @@ const backgroundImageClassName = css`
object-position: center;
`;
-const GlbMount = styled.div`
- display: block;
- height: 100%;
- inset: 0;
- min-width: 0;
- position: absolute;
- width: 100%;
- z-index: 1;
-`;
-
-// Same scanline shader as ProductVisual / IllustrationCardVisual; white uColor for Why Twenty.
-const scanlineVertexShader = /* glsl */ `
- varying vec3 vLocalPosition;
- varying vec3 vWorldPosition;
- varying vec3 vWorldNormal;
-
- void main() {
- vLocalPosition = position;
- vec4 worldPosition = modelMatrix * vec4(position, 1.0);
- vWorldPosition = worldPosition.xyz;
- vWorldNormal = normalize(mat3(modelMatrix) * normal);
- gl_Position = projectionMatrix * viewMatrix * worldPosition;
- }
-`;
-
-const scanlineFragmentShader = /* glsl */ `
- uniform vec3 uCameraPosition;
- uniform vec3 uColor;
- uniform vec3 uDigitFillColor;
- uniform vec2 uDigitCenterXY;
- uniform vec2 uDigitRadiusXY;
- uniform float uDigitZMin;
- uniform vec3 uLightDir;
- uniform float uStripeScale;
-
- varying vec3 vLocalPosition;
- varying vec3 vWorldPosition;
- varying vec3 vWorldNormal;
-
- void main() {
- vec3 normal = normalize(vWorldNormal);
- vec3 lightDir = normalize(uLightDir);
- vec3 viewDir = normalize(uCameraPosition - vWorldPosition);
- float ndotl = max(dot(normal, lightDir), 0.06);
- float ndotv = abs(dot(normal, viewDir));
-
- vec2 delta =
- (vLocalPosition.xy - uDigitCenterXY) / max(uDigitRadiusXY, vec2(0.0001));
- float inDigitXY = 1.0 - smoothstep(0.88, 1.42, length(delta));
- float inDigitZ = smoothstep(uDigitZMin - 2.5, uDigitZMin + 1.2, vLocalPosition.z);
- float facing = smoothstep(0.08, 0.72, ndotv);
- float digitMask = clamp(inDigitXY * mix(0.55, 1.0, inDigitZ) * facing, 0.0, 1.0);
-
- if (digitMask > 0.62) {
- gl_FragColor = vec4(uDigitFillColor, 1.0);
- return;
- }
-
- // Single-mesh GLB: offset stripe phase by normal so cutout "20" walls do not line up with the
- // rear face (reduces moiré / camouflage).
- float stripePhase =
- vWorldPosition.y * uStripeScale +
- (normal.x * 1.15 + normal.z * 0.9 + normal.y * 0.5) * 3.4;
- float cell = fract(stripePhase);
-
- // Grazing / engraved faces read brighter and keep slightly wider bands.
- float groove = smoothstep(0.1, 0.92, 1.0 - ndotv);
-
- float shadowWeight = mix(1.0, 0.48, ndotl);
- shadowWeight *= mix(1.0, 0.78, groove * 0.7);
-
- float lineWidth = 0.58 * shadowWeight;
- float edge = 0.035;
- float band = 1.0 - smoothstep(lineWidth, lineWidth + edge, cell);
-
- float highlight = pow(ndotl, 1.35);
- float dash = fract(vWorldPosition.x * 20.0 + vWorldPosition.z * 6.0);
- float dashMask = mix(
- 1.0,
- smoothstep(0.15, 0.45, dash) * (1.0 - smoothstep(0.55, 0.88, dash)),
- highlight
- );
- band *= dashMask;
-
- float speckle = fract(
- sin(dot(vWorldPosition.xz, vec2(127.1, 311.7))) * 43758.5453
- );
- band *= mix(1.0, 0.55 + 0.45 * step(0.4, speckle), highlight * 0.85);
-
- if (band < 0.015) {
- discard;
- }
-
- vec3 lit = uColor * mix(0.78, 1.22, ndotl);
- lit *= 1.0 + groove * 0.5;
- lit *= 1.0 + smoothstep(0.4, 0.92, 1.0 - ndotv) * 0.22;
-
- gl_FragColor = vec4(lit, band);
- }
-`;
-
-function disposeObjectSubtree(root: THREE.Object3D) {
- root.traverse((sceneObject) => {
- if (!(sceneObject instanceof THREE.Mesh)) {
- return;
- }
- sceneObject.geometry?.dispose();
- const material = sceneObject.material;
- if (Array.isArray(material)) {
- material.forEach((item) => item.dispose());
- } else {
- material?.dispose();
- }
- });
-}
-
-function createWhyTwentyScanlineMaterial(lightDirection: THREE.Vector3) {
- return new THREE.ShaderMaterial({
- uniforms: {
- uCameraPosition: { value: new THREE.Vector3() },
- uColor: { value: new THREE.Color('#ffffff') },
- uDigitFillColor: { value: new THREE.Color('#0a0a0c') },
- uDigitCenterXY: { value: new THREE.Vector2(0, 0) },
- uDigitRadiusXY: { value: new THREE.Vector2(1, 1) },
- uDigitZMin: { value: 0 },
- uLightDir: { value: lightDirection.clone() },
- uStripeScale: { value: 16.0 },
- },
- vertexShader: scanlineVertexShader,
- fragmentShader: scanlineFragmentShader,
- transparent: true,
- depthWrite: true,
- depthTest: true,
- side: THREE.DoubleSide,
- });
-}
-
-function applyWhyTwentyScanlineMaterials(
- modelRoot: THREE.Object3D,
- lightDirection: THREE.Vector3,
-) {
- modelRoot.traverse((sceneObject) => {
- if (!(sceneObject instanceof THREE.Mesh)) {
- return;
- }
-
- const geometry = sceneObject.geometry;
- if (!geometry.getAttribute('position')) {
- return;
- }
-
- geometry.computeBoundingBox();
- const box = geometry.boundingBox;
- if (!box) {
- return;
- }
-
- const centerX = (box.min.x + box.max.x) / 2;
- const centerY = (box.min.y + box.max.y) / 2;
- const sizeX = box.max.x - box.min.x;
- const sizeY = box.max.y - box.min.y;
- const sizeZ = box.max.z - box.min.z;
-
- const material = createWhyTwentyScanlineMaterial(lightDirection);
- material.uniforms.uDigitCenterXY.value.set(centerX, centerY);
- material.uniforms.uDigitRadiusXY.value.set(
- Math.max(sizeX * 0.135, 0.01),
- Math.max(sizeY * 0.105, 0.01),
- );
- material.uniforms.uDigitZMin.value = box.max.z - sizeZ * 0.14;
-
- sceneObject.material = material;
- });
-}
-
export function WhyTwentyVisual() {
- const glbMountReference = useRef<HTMLDivElement>(null);
-
- useEffect(() => {
- const container = glbMountReference.current;
- if (!container) return;
-
- let cancelled = false;
- let animationFrameId = 0;
-
- const scene = new THREE.Scene();
- const width = container.clientWidth;
- const height = container.clientHeight;
-
- const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
- camera.position.set(0, 0, 5.2);
-
- const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
- renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
- renderer.setSize(width, height);
- renderer.setClearColor(0x000000, 0);
- renderer.outputColorSpace = THREE.SRGBColorSpace;
-
- const canvas = renderer.domElement;
- canvas.style.display = 'block';
- canvas.style.height = '100%';
- canvas.style.width = '100%';
- canvas.style.cursor = 'crosshair';
- container.appendChild(canvas);
-
- const clock = new THREE.Clock();
- const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
- const cameraWorldPosition = new THREE.Vector3();
-
- const pivot = new THREE.Group();
- scene.add(pivot);
-
- let targetRotationX = 0;
- let targetRotationY = 0;
-
- const loader = new GLTFLoader();
- loader.load(HERO_GLB_URL, (gltf) => {
- if (cancelled) {
- disposeObjectSubtree(gltf.scene);
- return;
- }
-
- const modelRoot = gltf.scene;
- const bounds = new THREE.Box3().setFromObject(modelRoot);
- const center = bounds.getCenter(new THREE.Vector3());
- const size = bounds.getSize(new THREE.Vector3());
- const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
-
- const scale = 1.65 / maxAxis;
-
- modelRoot.position.sub(center);
- modelRoot.scale.setScalar(scale);
-
- modelRoot.rotation.set(0, -0.2, -0.2);
-
- applyWhyTwentyScanlineMaterials(modelRoot, lightDirectionWorld);
-
- pivot.add(modelRoot);
-
- pivot.position.x = 0.25;
-
- const renderFrame = () => {
- if (cancelled) return;
-
- animationFrameId = window.requestAnimationFrame(renderFrame);
- const time = clock.getElapsedTime();
-
- // Elegant, breathing float animation
- pivot.position.y = Math.sin(time * 1.5) * 0.06;
-
- // Fluid, luxurious mouse interaction (damped)
- pivot.rotation.x += (targetRotationX - pivot.rotation.x) * 0.05;
- pivot.rotation.y += (targetRotationY - pivot.rotation.y) * 0.05;
-
- camera.getWorldPosition(cameraWorldPosition);
- modelRoot.traverse((sceneObject) => {
- if (
- sceneObject instanceof THREE.Mesh &&
- sceneObject.material instanceof THREE.ShaderMaterial &&
- sceneObject.material.uniforms.uCameraPosition
- ) {
- sceneObject.material.uniforms.uCameraPosition.value.copy(
- cameraWorldPosition,
- );
- }
- });
-
- renderer.render(scene, camera);
- };
-
- renderFrame();
- });
-
- const handlePointerMove = (e: PointerEvent) => {
- const rect = canvas.getBoundingClientRect();
- const x = ((e.clientX - rect.left) / rect.width) * 2 - 1;
- const y = -(((e.clientY - rect.top) / rect.height) * 2 - 1);
-
- // Subtle tilt ranges
- targetRotationY = x * 0.35;
- targetRotationX = y * 0.25;
- };
-
- const handlePointerLeave = () => {
- targetRotationX = 0;
- targetRotationY = 0;
- };
-
- const handleResize = () => {
- if (!container || cancelled) return;
- const nextWidth = container.clientWidth;
- const nextHeight = container.clientHeight;
- camera.aspect = nextWidth / nextHeight;
- camera.updateProjectionMatrix();
- renderer.setSize(nextWidth, nextHeight);
- };
-
- canvas.addEventListener('pointermove', handlePointerMove);
- canvas.addEventListener('pointerleave', handlePointerLeave);
- window.addEventListener('resize', handleResize);
-
- return () => {
- cancelled = true;
- window.removeEventListener('resize', handleResize);
- canvas.removeEventListener('pointermove', handlePointerMove);
- canvas.removeEventListener('pointerleave', handlePointerLeave);
- window.cancelAnimationFrame(animationFrameId);
- disposeObjectSubtree(scene);
- renderer.dispose();
- if (canvas.parentNode === container) {
- container.removeChild(canvas);
- }
- };
- }, []);
-
return (
<VisualContainer>
<BackgroundLayer>
@@ -354,10 +35,10 @@ export function WhyTwentyVisual() {
fill
priority
sizes="100vw"
- src={HERO_BACKGROUND_SRC}
+ src="/images/why-twenty/hero/background.png"
/>
</BackgroundLayer>
- <GlbMount ref={glbMountReference} />
+ <WhyTwentyGlb />
</VisualContainer>
);
}
diff --git a/packages/twenty-website-new/src/sections/Hero/components/index.ts b/packages/twenty-website-new/src/sections/Hero/components/index.ts
index f413434fe5c..19601e27b69 100644
--- a/packages/twenty-website-new/src/sections/Hero/components/index.ts
+++ b/packages/twenty-website-new/src/sections/Hero/components/index.ts
@@ -1,11 +1,11 @@
+import { Product as ProductVisual } from '@/illustrations/Hero/Product';
import { PartnerVisual } from '@/sections/Hero/components/PartnerVisual/PartnerVisual';
-import { ProductVisual } from '@/sections/Hero/components/ProductVisual/ProductVisual';
+import { WhyTwentyVisual } from '@/sections/Hero/components/WhyTwentyVisual/WhyTwentyVisual';
import { Body } from './Body/Body';
import { Cta } from './Cta/Cta';
import { Heading } from './Heading/Heading';
import { HomeVisual } from './HomeVisual/HomeVisual';
import { Root } from './Root/Root';
-import { WhyTwentyVisual } from './WhyTwentyVisual/WhyTwentyVisual';
export const Hero = {
Root,
diff --git a/packages/twenty-website-new/src/sections/Hero/types/HeroIllustrationData.ts b/packages/twenty-website-new/src/sections/Hero/types/HeroIllustrationData.ts
index 8466dcaad8f..a3f57258ffb 100644
--- a/packages/twenty-website-new/src/sections/Hero/types/HeroIllustrationData.ts
+++ b/packages/twenty-website-new/src/sections/Hero/types/HeroIllustrationData.ts
@@ -1,6 +1,5 @@
-import { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
-import { HeroBaseDataType } from '@/sections/Hero/types/HeroBaseData';
+import { type HeroBaseDataType } from '@/sections/Hero/types/HeroBaseData';
export type HeroIllustrationDataType = HeroBaseDataType & {
- illustration: IllustrationType;
+ illustration: string;
};
diff --git a/packages/twenty-website-new/src/sections/Plans/components/Card/Card.tsx b/packages/twenty-website-new/src/sections/Plans/components/Card/Card.tsx
index 09fd3916370..7d5eaf2b496 100644
--- a/packages/twenty-website-new/src/sections/Plans/components/Card/Card.tsx
+++ b/packages/twenty-website-new/src/sections/Plans/components/Card/Card.tsx
@@ -2,12 +2,11 @@ import { styled } from '@linaria/react';
import { Body, Heading, LinkButton } from '@/design-system/components';
import { CheckIcon } from '@/icons/informative/Check';
+import { IllustrationMount } from '@/illustrations';
import type { PlanCardType } from '@/sections/Plans/types';
import { theme } from '@/theme';
import { css } from '@linaria/core';
-import { PlanCardVisual } from './PlanCardVisual';
-
const FIXED_ROWS = 4;
const StyledCard = styled.div`
@@ -149,10 +148,7 @@ export function Card({ card, highlighted = false, maxBullets }: CardProps) {
</PriceLine>
</CardHeaderInfo>
<CardIllustrationEmbed>
- <PlanCardVisual
- src={card.illustration.src}
- title={card.illustration.title}
- />
+ <IllustrationMount illustration={card.illustration} />
</CardIllustrationEmbed>
</CardHeader>
diff --git a/packages/twenty-website-new/src/sections/Plans/types/PlanCard.ts b/packages/twenty-website-new/src/sections/Plans/types/PlanCard.ts
index d03a8accdd3..ede0d20ba35 100644
--- a/packages/twenty-website-new/src/sections/Plans/types/PlanCard.ts
+++ b/packages/twenty-website-new/src/sections/Plans/types/PlanCard.ts
@@ -1,11 +1,11 @@
-import { HeadingType } from '@/design-system/components/Heading/types/Heading';
-import { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
-import { PlanFeaturesType } from '@/sections/Plans/types/PlanFeatures';
-import { PlanPriceType } from '@/sections/Plans/types/PlanPrice';
+import { type HeadingType } from '@/design-system/components/Heading/types/Heading';
+import type { IllustrationId } from '@/illustrations';
+import { type PlanFeaturesType } from '@/sections/Plans/types/PlanFeatures';
+import { type PlanPriceType } from '@/sections/Plans/types/PlanPrice';
export type PlanCardType = {
heading: HeadingType;
price: PlanPriceType;
- illustration: IllustrationType;
+ illustration: IllustrationId;
features: PlanFeaturesType;
};
diff --git a/packages/twenty-website-new/src/sections/Plans/types/PlansData.ts b/packages/twenty-website-new/src/sections/Plans/types/PlansData.ts
index 07ed1b9d609..ec0b5af7374 100644
--- a/packages/twenty-website-new/src/sections/Plans/types/PlansData.ts
+++ b/packages/twenty-website-new/src/sections/Plans/types/PlansData.ts
@@ -1,6 +1,6 @@
import type { BodyType } from '@/design-system/components/Body/types/Body';
import type { HeadingType } from '@/design-system/components/Heading/types/Heading';
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
+import type { IllustrationId } from '@/illustrations';
import type { PlanPriceType } from './PlanPrice';
// Same literals as UI toggles when reading cells.
@@ -29,7 +29,7 @@ export type PlansTierType = {
cells: PlansTierCellsType;
featuresTitle: BodyType;
heading: HeadingType;
- illustration: IllustrationType;
+ illustration: IllustrationId;
};
export type PlansDataType = {
diff --git a/packages/twenty-website-new/src/sections/Quote/components/Visual/Visual.tsx b/packages/twenty-website-new/src/sections/Quote/components/Visual/Visual.tsx
index f0922dbeb5a..7547a5e4946 100644
--- a/packages/twenty-website-new/src/sections/Quote/components/Visual/Visual.tsx
+++ b/packages/twenty-website-new/src/sections/Quote/components/Visual/Visual.tsx
@@ -1,353 +1,3 @@
'use client';
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
-import { theme } from '@/theme';
-import { styled } from '@linaria/react';
-import { useLayoutEffect, useRef } from 'react';
-import * as THREE from 'three';
-import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
-
-const QUOTE_VISUAL_MODEL_FIT_SCALE = 3.05;
-
-const scanlineVertexShader = /* glsl */ `
- varying vec3 vWorldPosition;
- varying vec3 vWorldNormal;
-
- void main() {
- vec4 worldPosition = modelMatrix * vec4(position, 1.0);
- vWorldPosition = worldPosition.xyz;
- vWorldNormal = normalize(mat3(modelMatrix) * normal);
- gl_Position = projectionMatrix * viewMatrix * worldPosition;
- }
-`;
-
-const scanlineFragmentShader = /* glsl */ `
- uniform vec3 uColor;
- uniform vec3 uLightDir;
- uniform float uStripeScale;
-
- varying vec3 vWorldPosition;
- varying vec3 vWorldNormal;
-
- void main() {
- vec3 normal = normalize(vWorldNormal);
- vec3 lightDir = normalize(uLightDir);
- float ndotl = max(dot(normal, lightDir), 0.06);
-
- float y = vWorldPosition.y * uStripeScale;
- float cell = fract(y);
-
- float shadowWeight = mix(1.0, 0.5, ndotl);
- float lineWidth = 0.58 * shadowWeight;
- float edge = 0.035;
- float band = 1.0 - smoothstep(lineWidth, lineWidth + edge, cell);
-
- float highlight = pow(ndotl, 1.35);
- float dash = fract(vWorldPosition.x * 20.0 + vWorldPosition.z * 6.0);
- float dashMask = mix(
- 1.0,
- smoothstep(0.15, 0.45, dash) * (1.0 - smoothstep(0.55, 0.88, dash)),
- highlight
- );
- band *= dashMask;
-
- float speckle = fract(
- sin(dot(vWorldPosition.xz, vec2(127.1, 311.7))) * 43758.5453
- );
- band *= mix(1.0, 0.55 + 0.45 * step(0.4, speckle), highlight * 0.85);
-
- if (band < 0.015) {
- discard;
- }
-
- vec3 lit = uColor * mix(0.72, 1.18, ndotl);
- gl_FragColor = vec4(lit, band);
- }
-`;
-
-function createScanlineMaterial(lightDirection: THREE.Vector3) {
- return new THREE.ShaderMaterial({
- uniforms: {
- uColor: { value: new THREE.Color('#1e5bff') },
- uLightDir: { value: lightDirection.clone() },
- uStripeScale: { value: 16.0 },
- },
- vertexShader: scanlineVertexShader,
- fragmentShader: scanlineFragmentShader,
- transparent: true,
- depthWrite: true,
- depthTest: true,
- side: THREE.DoubleSide,
- });
-}
-
-function disposeObjectSubtree(root: THREE.Object3D) {
- root.traverse((sceneObject) => {
- if (!(sceneObject instanceof THREE.Mesh)) {
- return;
- }
-
- sceneObject.geometry?.dispose();
-
- const material = sceneObject.material;
- if (Array.isArray(material)) {
- material.forEach((item) => item.dispose());
- } else {
- material?.dispose();
- }
- });
-}
-
-type MeshRestPose = {
- position: THREE.Vector3;
- quaternion: THREE.Quaternion;
- wobblePhase: number;
-};
-
-function applyScanlineMaterials(
- modelRoot: THREE.Object3D,
- lightDirection: THREE.Vector3,
-) {
- modelRoot.traverse((sceneObject) => {
- if (!(sceneObject instanceof THREE.Mesh)) {
- return;
- }
-
- sceneObject.material = createScanlineMaterial(lightDirection);
-
- const mesh = sceneObject;
- const rest: MeshRestPose = {
- position: mesh.position.clone(),
- quaternion: mesh.quaternion.clone(),
- wobblePhase: mesh.position.y * 4.2 + mesh.position.x * 1.7,
- };
- mesh.userData.quoteVisualRest = rest;
- });
-}
-
-const VisualContainer = styled.div`
- background-color: transparent;
- border-radius: ${theme.radius(1)};
- height: min(544px, 70vw);
- min-height: ${theme.spacing(80)};
- overflow: hidden;
- position: relative;
- width: 100%;
-
- @media (min-width: ${theme.breakpoints.md}px) {
- height: 544px;
- max-width: 646px;
- }
-`;
-
-const CanvasMount = styled.div`
- display: block;
- height: 100%;
- inset: 0;
- min-width: 0;
- position: absolute;
- width: 100%;
-`;
-
-type VisualProps = {
- illustration: IllustrationType;
-};
-
-export function Visual({ illustration }: VisualProps) {
- const mountReference = useRef<HTMLDivElement>(null);
-
- useLayoutEffect(() => {
- const container = mountReference.current;
- if (!container) {
- return;
- }
-
- let cancelled = false;
- let animationFrameId = 0;
-
- const pointer = { x: 0, y: 0, inside: false };
- const targetRotation = { x: 0, y: 0 };
- const lightDirectionWorld = new THREE.Vector3(4, 8, 6).normalize();
-
- const scene = new THREE.Scene();
- const width = container.clientWidth;
- const height = container.clientHeight;
-
- const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
- camera.position.set(0, 0, 5.05);
-
- const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
- renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
- renderer.setSize(width, height);
- renderer.setClearColor(0x000000, 0);
- renderer.outputColorSpace = THREE.SRGBColorSpace;
- const canvas = renderer.domElement;
- canvas.style.cursor = 'pointer';
- canvas.style.display = 'block';
- canvas.style.height = '100%';
- canvas.style.touchAction = 'none';
- canvas.style.width = '100%';
- container.appendChild(canvas);
-
- const pivot = new THREE.Group();
- scene.add(pivot);
-
- const clock = new THREE.Clock();
-
- const loader = new GLTFLoader();
- loader.load(
- illustration.src,
- (gltf) => {
- if (cancelled) {
- disposeObjectSubtree(gltf.scene);
- return;
- }
-
- const modelRoot = gltf.scene;
- const bounds = new THREE.Box3().setFromObject(modelRoot);
- const center = bounds.getCenter(new THREE.Vector3());
- const size = bounds.getSize(new THREE.Vector3());
- const maxAxis = Math.max(size.x, size.y, size.z, 0.001);
- const scale = QUOTE_VISUAL_MODEL_FIT_SCALE / maxAxis;
-
- modelRoot.position.sub(center);
- modelRoot.scale.setScalar(scale);
-
- applyScanlineMaterials(modelRoot, lightDirectionWorld);
- pivot.add(modelRoot);
-
- const renderFrame = () => {
- if (cancelled) {
- return;
- }
-
- animationFrameId = window.requestAnimationFrame(renderFrame);
- const delta = Math.min(clock.getDelta(), 0.1);
-
- const rotationDamp = 6.8;
- const influence = pointer.inside ? 1 : 0.38;
- targetRotation.y = pointer.x * 0.78 * influence;
- targetRotation.x = pointer.y * 0.62 * influence;
-
- pivot.rotation.y = THREE.MathUtils.damp(
- pivot.rotation.y,
- targetRotation.y,
- rotationDamp,
- delta,
- );
- pivot.rotation.x = THREE.MathUtils.damp(
- pivot.rotation.x,
- targetRotation.x,
- rotationDamp,
- delta,
- );
-
- const hoverLift = pointer.inside ? 1 : 0;
- pivot.scale.setScalar(
- THREE.MathUtils.damp(pivot.scale.x, 1 + hoverLift * 0.12, 7, delta),
- );
-
- const mx = pointer.x * (pointer.inside ? 1 : 0.32);
- const my = pointer.y * (pointer.inside ? 1 : 0.32);
-
- modelRoot.traverse((sceneObject) => {
- if (!(sceneObject instanceof THREE.Mesh)) {
- return;
- }
-
- const rest = sceneObject.userData.quoteVisualRest as
- | MeshRestPose
- | undefined;
- if (!rest) {
- return;
- }
-
- const phase = rest.wobblePhase;
- const wobble = pointer.inside ? 1 : 0.36;
- sceneObject.position.x =
- rest.position.x + mx * 0.22 * Math.sin(phase * 1.8);
- sceneObject.position.z =
- rest.position.z + my * 0.19 * Math.cos(phase * 1.4);
- sceneObject.position.y =
- rest.position.y + (mx + my) * 0.055 * Math.sin(phase * 2.5);
-
- const twist = (mx * 0.34 + my * 0.24) * wobble * Math.sin(phase);
- sceneObject.quaternion.copy(rest.quaternion);
- sceneObject.rotateY(twist);
- });
-
- renderer.render(scene, camera);
- };
-
- renderFrame();
- },
- undefined,
- undefined,
- );
-
- const setPointerFromEvent = (event: PointerEvent) => {
- const rect = canvas.getBoundingClientRect();
- const normalizedX = ((event.clientX - rect.left) / rect.width) * 2 - 1;
- const normalizedY = -(((event.clientY - rect.top) / rect.height) * 2 - 1);
- pointer.x = THREE.MathUtils.clamp(normalizedX, -1, 1);
- pointer.y = THREE.MathUtils.clamp(normalizedY, -1, 1);
- };
-
- const handlePointerEnter = () => {
- pointer.inside = true;
- };
-
- const handlePointerLeave = () => {
- pointer.inside = false;
- pointer.x = 0;
- pointer.y = 0;
- };
-
- const handlePointerMove = (event: PointerEvent) => {
- setPointerFromEvent(event);
- };
-
- canvas.addEventListener('pointerenter', handlePointerEnter);
- canvas.addEventListener('pointerleave', handlePointerLeave);
- canvas.addEventListener('pointermove', handlePointerMove);
-
- const handleResize = () => {
- if (!mountReference.current || cancelled) {
- return;
- }
-
- const nextWidth = mountReference.current.clientWidth;
- const nextHeight = mountReference.current.clientHeight;
- camera.aspect = nextWidth / nextHeight;
- camera.updateProjectionMatrix();
- renderer.setSize(nextWidth, nextHeight);
- };
-
- window.addEventListener('resize', handleResize);
-
- return () => {
- cancelled = true;
- window.removeEventListener('resize', handleResize);
- canvas.removeEventListener('pointerenter', handlePointerEnter);
- canvas.removeEventListener('pointerleave', handlePointerLeave);
- canvas.removeEventListener('pointermove', handlePointerMove);
- window.cancelAnimationFrame(animationFrameId);
- disposeObjectSubtree(scene);
- renderer.dispose();
-
- if (canvas.parentNode === container) {
- container.removeChild(canvas);
- }
- };
- }, [illustration.src]);
-
- return (
- <VisualContainer>
- <CanvasMount
- aria-label={illustration.title}
- ref={mountReference}
- role="img"
- />
- </VisualContainer>
- );
-}
+export { IllustrationMount as Visual } from '@/illustrations';
diff --git a/packages/twenty-website-new/src/sections/Quote/types/QuoteData.ts b/packages/twenty-website-new/src/sections/Quote/types/QuoteData.ts
index 16b4bb7bb13..87afdbc5cd6 100644
--- a/packages/twenty-website-new/src/sections/Quote/types/QuoteData.ts
+++ b/packages/twenty-website-new/src/sections/Quote/types/QuoteData.ts
@@ -1,7 +1,7 @@
import type { HeadingType } from '@/design-system/components/Heading/types/Heading';
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
+import type { IllustrationId } from '@/illustrations';
export type QuoteDataType = {
- illustration: IllustrationType;
+ illustration: IllustrationId;
heading: HeadingType[];
};
diff --git a/packages/twenty-website-new/src/sections/Testimonials/components/index.ts b/packages/twenty-website-new/src/sections/Testimonials/components/index.ts
index c0686cb1bc1..c7984d2f329 100644
--- a/packages/twenty-website-new/src/sections/Testimonials/components/index.ts
+++ b/packages/twenty-website-new/src/sections/Testimonials/components/index.ts
@@ -1,12 +1,12 @@
+import { Hourglass } from '@/illustrations/Testimonials/Hourglass';
+import { Partner as PartnerVisual } from '@/illustrations/Testimonials/Partner';
import { Carousel } from './Carousel/Carousel';
-import { HomeVisual } from './HomeVisual/HomeVisual';
-import { PartnerVisual } from './PartnerVisual/PartnerVisual';
import { Root } from './Root/Root';
import { Separator } from './Separator/Separator';
export const Testimonials = {
Carousel,
- HomeVisual,
+ HomeVisual: Hourglass,
PartnerVisual,
Root,
Separator,
diff --git a/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCard.tsx b/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCard.tsx
index bb24cf6cf76..1296e36187f 100644
--- a/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCard.tsx
+++ b/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCard.tsx
@@ -1,9 +1,11 @@
+'use client';
+
import { Body, Heading, IconButton } from '@/design-system/components';
import { ArrowRightIcon } from '@/icons';
+import { THREE_CARDS_ILLUSTRATIONS } from '@/illustrations';
import type { ThreeCardsIllustrationCardType } from '@/sections/ThreeCards/types';
import { theme } from '@/theme';
import { styled } from '@linaria/react';
-import { IllustrationCardVisual } from './IllustrationCardVisual';
import { ThreeCardsCardShape } from './CardShape';
const IllustrationCardContainer = styled.div`
@@ -70,6 +72,9 @@ export function IllustrationCard({
illustrationCard,
variant = 'shaped',
}: IllustrationCardProps) {
+ const ThreeCardsIllustration =
+ THREE_CARDS_ILLUSTRATIONS[illustrationCard.illustration];
+
return (
<IllustrationCardContainer>
{variant === 'shaped' && (
@@ -86,10 +91,7 @@ export function IllustrationCard({
/>
<CardRule />
<CardEmbed>
- <IllustrationCardVisual
- src={illustrationCard.illustration.src}
- title={illustrationCard.illustration.title}
- />
+ <ThreeCardsIllustration />
</CardEmbed>
<CardRule />
<CardBodyCell>
diff --git a/packages/twenty-website-new/src/sections/ThreeCards/types/ThreeCardsIllustrationCard.ts b/packages/twenty-website-new/src/sections/ThreeCards/types/ThreeCardsIllustrationCard.ts
index 9a6c94c8366..7c63839eb1a 100644
--- a/packages/twenty-website-new/src/sections/ThreeCards/types/ThreeCardsIllustrationCard.ts
+++ b/packages/twenty-website-new/src/sections/ThreeCards/types/ThreeCardsIllustrationCard.ts
@@ -1,12 +1,12 @@
-import { BodyType } from '@/design-system/components/Body/types/Body';
-import { HeadingType } from '@/design-system/components/Heading/types/Heading';
-import { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
-import { ThreeCardsIllustrationCardAttributionType } from './ThreeCardsIllustrationCardAttribution';
+import { type BodyType } from '@/design-system/components/Body/types/Body';
+import { type HeadingType } from '@/design-system/components/Heading/types/Heading';
+import type { ThreeCardsIllustrationId } from '@/illustrations';
+import { type ThreeCardsIllustrationCardAttributionType } from './ThreeCardsIllustrationCardAttribution';
export type ThreeCardsIllustrationCardType = {
heading: HeadingType;
body: BodyType;
benefits?: BodyType[];
attribution?: ThreeCardsIllustrationCardAttributionType;
- illustration: IllustrationType;
+ illustration: ThreeCardsIllustrationId;
};
diff --git a/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/Flow/Flow.tsx b/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/Flow/Flow.tsx
index 4a130e717e4..278a176c114 100644
--- a/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/Flow/Flow.tsx
+++ b/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/Flow/Flow.tsx
@@ -1,11 +1,11 @@
'use client';
+import { IllustrationMount } from '@/illustrations';
import { SyncScrollProgressFromContainerEffect } from '@/sections/WhyTwentyStepper/effect-components/SyncScrollProgressFromContainerEffect';
import type { WhyTwentyStepperDataType } from '@/sections/WhyTwentyStepper/types';
import { useRef, useState } from 'react';
import { Content } from '../Content/Content';
import { Root } from '../Root/Root';
-import { Visual } from '../Visual/Visual';
type FlowProps = WhyTwentyStepperDataType;
@@ -32,7 +32,7 @@ export function Flow({ body, heading, illustration }: FlowProps) {
heading={heading}
localProgress={localProgress}
/>
- <Visual illustration={illustration} />
+ <IllustrationMount illustration={illustration} />
</Root>
);
}
diff --git a/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/index.ts b/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/index.ts
index c24d113d28b..76160f6ca94 100644
--- a/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/index.ts
+++ b/packages/twenty-website-new/src/sections/WhyTwentyStepper/components/index.ts
@@ -1,11 +1,9 @@
import { Content } from './Content/Content';
import { Flow } from './Flow/Flow';
import { Root } from './Root/Root';
-import { Visual } from './Visual/Visual';
export const WhyTwentyStepper = {
Content,
Flow,
Root,
- Visual,
};
diff --git a/packages/twenty-website-new/src/sections/WhyTwentyStepper/types/WhyTwentyStepperData.ts b/packages/twenty-website-new/src/sections/WhyTwentyStepper/types/WhyTwentyStepperData.ts
index ffc1af89d5e..0fc1ebdb477 100644
--- a/packages/twenty-website-new/src/sections/WhyTwentyStepper/types/WhyTwentyStepperData.ts
+++ b/packages/twenty-website-new/src/sections/WhyTwentyStepper/types/WhyTwentyStepperData.ts
@@ -1,9 +1,9 @@
import type { BodyType } from '@/design-system/components/Body/types/Body';
import type { HeadingType } from '@/design-system/components/Heading/types/Heading';
-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';
+import type { IllustrationId } from '@/illustrations';
export type WhyTwentyStepperDataType = {
heading: HeadingType;
body: BodyType[];
- illustration: IllustrationType;
+ illustration: IllustrationId;
};