The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Styled illustrations for Hero, ThreeCards, Helped sections. (#19387)
Abdullah.d324bbfc25b9
diff --git a/packages/twenty-website-new/public/illustrations/why-twenty/hero/logo.glb b/packages/twenty-website-new/public/illustrations/why-twenty/hero/hero.glbsimilarity index 100%rename from packages/twenty-website-new/public/illustrations/why-twenty/hero/logo.glbrename to packages/twenty-website-new/public/illustrations/why-twenty/hero/hero.glbdiff --git a/packages/twenty-website-new/public/images/partner/hero/hero.png b/packages/twenty-website-new/public/images/partner/hero/hero.pngnew file mode 100644index 00000000000..e3f4e261182Binary files /dev/null and b/packages/twenty-website-new/public/images/partner/hero/hero.png differdiff --git a/packages/twenty-website-new/src/app/(home)/_constants/helped.ts b/packages/twenty-website-new/src/app/(home)/_constants/helped.tsindex a29c885fd4f..489ea830894 100644--- a/packages/twenty-website-new/src/app/(home)/_constants/helped.ts+++ b/packages/twenty-website-new/src/app/(home)/_constants/helped.ts@@ -27,6 +27,7 @@ export const HELPED_DATA: HelpedDataType = {illustration: {src: '/illustrations/home/helped/one.glb',title: '',+ color: '#DE8CF6',},},{@@ -38,6 +39,7 @@ export const HELPED_DATA: HelpedDataType = {illustration: {src: '/illustrations/home/helped/two.glb',title: '',+ color: '#89FC9A',},},@@ -50,6 +52,7 @@ export const HELPED_DATA: HelpedDataType = {illustration: {src: '/illustrations/home/helped/three.glb',title: '',+ color: '#E4E58A',},},],diff --git a/packages/twenty-website-new/src/app/partner/page.tsx b/packages/twenty-website-new/src/app/partner/page.tsxindex 65844e0203c..518d3e1914c 100644--- a/packages/twenty-website-new/src/app/partner/page.tsx+++ b/packages/twenty-website-new/src/app/partner/page.tsx@@ -64,10 +64,7 @@ export default async function PartnerPage() {variant="contained"/></Hero.Cta>- <Hero.Illustration- illustration={HERO_DATA.illustration}- backgroundColor={theme.colors.secondary.background[100]}- />+ <Hero.PartnerVisual /></Hero.Root><TrustedBy.Root>diff --git a/packages/twenty-website-new/src/app/product/page.tsx b/packages/twenty-website-new/src/app/product/page.tsxindex a4da57c2690..80df1b3d759 100644--- a/packages/twenty-website-new/src/app/product/page.tsx+++ b/packages/twenty-website-new/src/app/product/page.tsx@@ -59,10 +59,7 @@ export default async function ProductPage() {variant="contained"/></Hero.Cta>- <Hero.Illustration- illustration={HERO_DATA.illustration}- backgroundColor={theme.colors.secondary.background[5]}- />+ <Hero.ProductVisual /></Hero.Root><TrustedBy.Root>diff --git a/packages/twenty-website-new/src/app/why-twenty/_constants/hero.ts b/packages/twenty-website-new/src/app/why-twenty/_constants/hero.tsindex 7e8ef03690a..d80d6fcbf8c 100644--- a/packages/twenty-website-new/src/app/why-twenty/_constants/hero.ts+++ b/packages/twenty-website-new/src/app/why-twenty/_constants/hero.ts@@ -2,18 +2,10 @@ import type { HeroWhyTwentyDataType } from '@/sections/Hero/types';export const HERO_DATA: HeroWhyTwentyDataType = {heading: [- { text: 'The future of CRM is built, ', fontFamily: 'serif' },- { text: 'not bought.', fontFamily: 'sans' },+ { text: 'The future of CRM is built,', fontFamily: 'serif' },+ { text: ' not bought.', fontFamily: 'sans' },],body: {text: 'Most packaged software makes companies more similar. CRM is no exception. AI is turning software into a commodity. That does not make your go-to-market a commodity. It makes it the battleground.',},- image: {- src: '/images/why-twenty/hero/background.png',- alt: '',- },- illustration: {- src: '/illustrations/why-twenty/hero/logo.glb',- title: 'Why Twenty hero illustration',- },};diff --git a/packages/twenty-website-new/src/app/why-twenty/page.tsx b/packages/twenty-website-new/src/app/why-twenty/page.tsxindex c626d7fef25..184f1d62fb1 100644--- a/packages/twenty-website-new/src/app/why-twenty/page.tsx+++ b/packages/twenty-website-new/src/app/why-twenty/page.tsx@@ -58,10 +58,7 @@ export default async function WhyTwentyPage() {size="xl"/><Hero.Body page={Pages.WhyTwenty} body={HERO_DATA.body} />- <Hero.WhyTwentyVisual- image={HERO_DATA.image}- illustration={HERO_DATA.illustration}- />+ <Hero.WhyTwentyVisual /></Hero.Root><Editorial.Rootdiff --git a/packages/twenty-website-new/src/constants/website-glb-urls.ts b/packages/twenty-website-new/src/constants/website-glb-urls.tsindex 8987703a579..bbb16fcea45 100644--- a/packages/twenty-website-new/src/constants/website-glb-urls.ts+++ b/packages/twenty-website-new/src/constants/website-glb-urls.ts@@ -8,7 +8,6 @@ import { THREE_CARDS_ILLUSTRATION_DATA as PARTNER_THREE_CARDS_DATA } from '@/appimport { PLANS_DATA } from '@/app/pricing/_constants/plans';import { HERO_DATA as PRODUCT_HERO_DATA } from '@/app/product/_constants/hero';import { THREE_CARDS_ILLUSTRATION_DATA as PRODUCT_THREE_CARDS_DATA } from '@/app/product/_constants/three-cards';-import { HERO_DATA as WHY_TWENTY_HERO_DATA } from '@/app/why-twenty/_constants/hero';import { QUOTE_DATA } from '@/app/why-twenty/_constants/quote';import { STEPPER_DATA } from '@/app/why-twenty/_constants/stepper';@@ -49,7 +48,6 @@ export const getAllWebsiteGlbUrls = (): string[] => {addIfGlb(urls, PARTNER_TESTIMONIALS_DATA.illustration.src);- addIfGlb(urls, WHY_TWENTY_HERO_DATA.illustration.src);addIfGlb(urls, STEPPER_DATA.illustration.src);addIfGlb(urls, QUOTE_DATA.illustration.src);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.tsxindex 3d0bb9ad012..9175709dc22 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,14 +1,10 @@-import {- Body,- Heading,- LazyEmbed,- LinkButton,-} from '@/design-system/components';+import { Body, Heading, LinkButton } from '@/design-system/components';import { CLIENT_ICONS } from '@/icons';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;@@ -53,26 +49,6 @@ const VisualShell = styled.div`width: 100%;`;-const StyledIframe = styled(LazyEmbed)`- border: none;- height: 200%;- left: 51.5%;- mix-blend-mode: lighten;- pointer-events: none;- position: absolute;- top: 50%;- transform: translate(-50%, -50%);- width: 200%;-`;--const HueOverlay = styled.div`- background-color: ${theme.colors.highlight[100]};- inset: 0;- mix-blend-mode: hue;- pointer-events: none;- position: absolute;-`;-const CopyBlock = styled.div`display: grid;grid-template-columns: 1fr;@@ -117,14 +93,11 @@ export function Card({ card }: CardProps) {</LogoRow><Rule aria-hidden="true" /><VisualShell>- <StyledIframe- allow="clipboard-write; encrypted-media; gyroscope; web-share"- allowFullScreen- referrerPolicy="strict-origin-when-cross-origin"+ <HelpedCardVisualsrc={card.illustration.src}+ stripeColor={card.illustration.color}title={card.illustration.title || 'Case illustration'}/>- <HueOverlay aria-hidden="true" /></VisualShell><Rule aria-hidden="true" /><CopyBlock>diff --git a/packages/twenty-website-new/src/sections/Helped/components/Card/HelpedCardVisual.tsx b/packages/twenty-website-new/src/sections/Helped/components/Card/HelpedCardVisual.tsxnew file mode 100644index 00000000000..c8df9c8123b--- /dev/null+++ b/packages/twenty-website-new/src/sections/Helped/components/Card/HelpedCardVisual.tsx@@ -0,0 +1,384 @@+'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';++// 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 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.helpedCardVisualRest = rest;+ });+}++const StyledVisualMount = styled.div`+ display: block;+ height: 100%;+ min-width: 0;+ width: 100%;+`;++export type HelpedCardVisualProps = {+ src: string;+ stripeColor: string;+ title: string;+};++export function HelpedCardVisual({+ src,+ stripeColor,+ title,+}: HelpedCardVisualProps) {+ 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(+ 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 = HELPED_CARD_VISUAL_MODEL_FIT_SCALE / maxAxis;++ modelRoot.position.sub(center);+ modelRoot.scale.setScalar(scale);++ applyScanlineMaterials(modelRoot, lightDirectionWorld, stripeColor);+ pivot.add(modelRoot);++ const renderFrame = () => {+ if (cancelled) {+ return;+ }++ animationFrameId = window.requestAnimationFrame(renderFrame);+ const delta = Math.min(clock.getDelta(), 0.1);++ const motion = HELPED_CARD_VISUAL_MOTION_SCALE;+ 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.helpedCardVisualRest 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);+ }+ };+ }, [src, stripeColor]);++ return (+ <StyledVisualMount aria-label={title} ref={mountReference} role="img" />+ );+}diff --git a/packages/twenty-website-new/src/sections/Helped/types/HeadingCard.ts b/packages/twenty-website-new/src/sections/Helped/types/HeadingCard.tsindex 8e1b0629038..7eac95565c5 100644--- a/packages/twenty-website-new/src/sections/Helped/types/HeadingCard.ts+++ b/packages/twenty-website-new/src/sections/Helped/types/HeadingCard.ts@@ -4,7 +4,7 @@ import type { IllustrationType } from '@/design-system/components/Illustration/texport type HeadingCardType = {icon: string;- illustration: IllustrationType;+ illustration: IllustrationType & { color: string };heading: HeadingType;body: BodyType;};diff --git a/packages/twenty-website-new/src/sections/Hero/components/Illustration/Illustration.tsx b/packages/twenty-website-new/src/sections/Hero/components/Illustration/Illustration.tsxdeleted file mode 100644index ed99813d9a6..00000000000--- a/packages/twenty-website-new/src/sections/Hero/components/Illustration/Illustration.tsx+++ /dev/null@@ -1,48 +0,0 @@-import { LazyEmbed } from '@/design-system/components';-import type { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';-import { theme } from '@/theme';-import { styled } from '@linaria/react';--const StyledIllustrationContainer = styled.div`- justify-self: stretch;- margin-top: ${theme.spacing(6)};- max-width: 100%;- min-width: 0;- width: 100%;-`;--const StyledIllustrationEmbed = styled(LazyEmbed)`- border: none;- display: block;- height: 462px;- max-width: 100%;- min-width: 0;- width: 100%;-`;--type IllustrationProps = {- illustration: IllustrationType;- backgroundColor: string;-};--export function Illustration({- illustration,- backgroundColor,-}: IllustrationProps) {- return (- <StyledIllustrationContainer>- <StyledIllustrationEmbed- eager- src={illustration.src}- title={illustration.title}- unloadWhenHidden={false}- allow="clipboard-write; encrypted-media; gyroscope; web-share"- referrerPolicy="strict-origin-when-cross-origin"- allowFullScreen- style={{- backgroundColor: backgroundColor,- }}- />- </StyledIllustrationContainer>- );-}diff --git a/packages/twenty-website-new/src/sections/Hero/components/PartnerVisual/PartnerVisual.tsx b/packages/twenty-website-new/src/sections/Hero/components/PartnerVisual/PartnerVisual.tsxnew file mode 100644index 00000000000..1684d17fda5--- /dev/null+++ b/packages/twenty-website-new/src/sections/Hero/components/PartnerVisual/PartnerVisual.tsx@@ -0,0 +1,33 @@+import { theme } from '@/theme';+import { css } from '@linaria/core';+import { styled } from '@linaria/react';+import NextImage from 'next/image';++const StyledContainer = styled.div`+ background-color: ${theme.colors.secondary.background[100]};+ height: 462px;+ margin-top: ${theme.spacing(6)};+ overflow: hidden;+ position: relative;+ width: 100%;+`;++const partnerHeroImageClassName = css`+ object-fit: contain;+ object-position: center;+`;++export function PartnerVisual() {+ return (+ <StyledContainer>+ <NextImage+ alt="Twenty partners"+ className={partnerHeroImageClassName}+ fill+ priority+ sizes="100vw"+ src="/images/partner/hero/hero.png"+ />+ </StyledContainer>+ );+}diff --git a/packages/twenty-website-new/src/sections/Hero/components/ProductVisual/ProductVisual.tsx b/packages/twenty-website-new/src/sections/Hero/components/ProductVisual/ProductVisual.tsxnew file mode 100644index 00000000000..5626953def9--- /dev/null+++ b/packages/twenty-website-new/src/sections/Hero/components/ProductVisual/ProductVisual.tsx@@ -0,0 +1,335 @@+'use client';++import { theme } from '@/theme';+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 HERO_GLB_URL = '/illustrations/product/hero/hero.glb';++const StyledContainer = styled.div`+ background-color: ${theme.colors.secondary.background[5]};+ height: 462px;+ margin-top: ${theme.spacing(6)};+ width: 100%;+`;++const StyledGlbMount = styled.div`+ display: block;+ height: 100%;+ min-width: 0;+ width: 100%;+`;++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.productVisualRest = rest;+ });+}++export function ProductVisual() {+ const containerReference = useRef<HTMLDivElement>(null);++ useEffect(() => {+ const container = containerReference.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 clock = new THREE.Clock();++ 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 = 4.85 / maxAxis;++ modelRoot.position.sub(center);+ modelRoot.scale.setScalar(scale);++ applyScanlineMaterials(modelRoot, lightDirectionWorld);+ pivot.add(modelRoot);+ pivot.rotation.z = 0.9;++ 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.productVisualRest 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 (!containerReference.current || cancelled) {+ return;+ }++ const nextWidth = containerReference.current.clientWidth;+ const nextHeight = containerReference.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 (+ <StyledContainer>+ <StyledGlbMount ref={containerReference} />+ </StyledContainer>+ );+}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.tsxindex 904e5e4df91..31ed87df378 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,8 +1,15 @@-import { Image, LazyEmbed } from '@/design-system/components';-import { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';-import { ImageType } from '@/design-system/components/Image/types/Image';+'use client';+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)};@@ -12,40 +19,345 @@ const VisualContainer = styled.div`width: 100%;`;-const StyledBackground = styled(Image)`- aspect-ratio: auto;- height: 100%;+const BackgroundLayer = styled.div`+ inset: 0;+ position: absolute;+ z-index: 0;`;-const StyledIframe = styled(LazyEmbed)`- border: none;- height: 200%;- mix-blend-mode: lighten;+const backgroundImageClassName = css`+ object-fit: cover;+ object-position: center;+`;++const GlbMount = styled.div`+ display: block;+ height: 100%;+ inset: 0;+ min-width: 0;position: absolute;- top: 50%;- left: 51.5%;- transform: translate(-50%, -50%);- width: 200%;+ 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);+ }`;-type WhyTwentyVisualProps = {- image: ImageType;- illustration: IllustrationType;-};+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);+ }+ };+ }, []);-export function WhyTwentyVisual({ image, illustration }: WhyTwentyVisualProps) {return (<VisualContainer>- <StyledBackground src={image.src} alt={image.alt} />- <StyledIframe- eager- src={illustration.src}- title={illustration.title}- unloadWhenHidden={false}- allow="clipboard-write; encrypted-media; gyroscope; web-share"- referrerPolicy="strict-origin-when-cross-origin"- allowFullScreen- />+ <BackgroundLayer>+ <NextImage+ alt="Why Twenty hero background"+ className={backgroundImageClassName}+ fill+ priority+ sizes="100vw"+ src={HERO_BACKGROUND_SRC}+ />+ </BackgroundLayer>+ <GlbMount ref={glbMountReference} /></VisualContainer>);}diff --git a/packages/twenty-website-new/src/sections/Hero/components/index.ts b/packages/twenty-website-new/src/sections/Hero/components/index.tsindex d6794a31f3f..f413434fe5c 100644--- a/packages/twenty-website-new/src/sections/Hero/components/index.ts+++ b/packages/twenty-website-new/src/sections/Hero/components/index.ts@@ -1,8 +1,9 @@+import { PartnerVisual } from '@/sections/Hero/components/PartnerVisual/PartnerVisual';+import { ProductVisual } from '@/sections/Hero/components/ProductVisual/ProductVisual';import { Body } from './Body/Body';import { Cta } from './Cta/Cta';import { Heading } from './Heading/Heading';import { HomeVisual } from './HomeVisual/HomeVisual';-import { Illustration } from './Illustration/Illustration';import { Root } from './Root/Root';import { WhyTwentyVisual } from './WhyTwentyVisual/WhyTwentyVisual';@@ -11,7 +12,8 @@ export const Hero = {Heading,Body,Cta,- Illustration,HomeVisual,+ ProductVisual,+ PartnerVisual,WhyTwentyVisual,};diff --git a/packages/twenty-website-new/src/sections/Hero/types/HeroWhyTwentyData.ts b/packages/twenty-website-new/src/sections/Hero/types/HeroWhyTwentyData.tsindex 901ba93444b..a429b860399 100644--- a/packages/twenty-website-new/src/sections/Hero/types/HeroWhyTwentyData.ts+++ b/packages/twenty-website-new/src/sections/Hero/types/HeroWhyTwentyData.ts@@ -1,8 +1,3 @@-import { IllustrationType } from '@/design-system/components/Illustration/types/Illustration';-import { ImageType } from '@/design-system/components/Image/types/Image';import { HeroBaseDataType } from '@/sections/Hero/types/HeroBaseData';-export type HeroWhyTwentyDataType = HeroBaseDataType & {- image: ImageType;- illustration: IllustrationType;-};+export type HeroWhyTwentyDataType = HeroBaseDataType;diff --git a/packages/twenty-website-new/src/sections/Quote/components/Heading/Heading.tsx b/packages/twenty-website-new/src/sections/Quote/components/Heading/Heading.tsxindex 9d8404f0578..0e1db974094 100644--- a/packages/twenty-website-new/src/sections/Quote/components/Heading/Heading.tsx+++ b/packages/twenty-website-new/src/sections/Quote/components/Heading/Heading.tsx@@ -10,30 +10,6 @@ const HeadingWrapper = styled.div`white-space: pre-line;width: 100%;position: relative;- transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);-- /* Apple-style floating quote marks on hover */- &::before {- content: '"';- position: absolute;- left: -32px;- top: -16px;- font-size: 64px;- color: ${theme.colors.secondary.border[20]};- opacity: 0;- transform: translateY(20px);- transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);- font-family: ${theme.font.family.serif};- }-- &:hover {- transform: translateX(12px);- }-- &:hover::before {- opacity: 1;- transform: translateY(0);- }@media (min-width: ${theme.breakpoints.md}px) {max-width: 517px;diff --git a/packages/twenty-website-new/src/sections/Quote/components/Root/Root.tsx b/packages/twenty-website-new/src/sections/Quote/components/Root/Root.tsxindex b9d8c970750..8d499464565 100644--- a/packages/twenty-website-new/src/sections/Quote/components/Root/Root.tsx+++ b/packages/twenty-website-new/src/sections/Quote/components/Root/Root.tsx@@ -19,23 +19,6 @@ const StyledContainer = styled(Container)`padding-top: ${theme.spacing(12)};row-gap: ${theme.spacing(10)};- /* Smooth transition for the children elements */- & > * {- transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);- }-- /* When hovering over one column, dramatically shrink and dim the other */- &:has(div:hover) > div:not(:hover) {- opacity: 0.2;- transform: scale(0.9) translateX(20px);- }-- /* When hovering, the active column scales slightly */- &:has(> div:hover) > div:hover {- transform: scale(1.02);- z-index: 2;- }-@media (min-width: ${theme.breakpoints.md}px) {align-items: center;column-gap: ${theme.spacing(8)};diff --git a/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/GlbViewer.tsx b/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/GlbViewer.tsxdeleted file mode 100644index 5c9055fe169..00000000000--- a/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/GlbViewer.tsx+++ /dev/null@@ -1,146 +0,0 @@-'use client';--import { Center, useGLTF, Float, PresentationControls } from '@react-three/drei';-import { Canvas, useFrame } from '@react-three/fiber';-import { Suspense, useMemo, useRef, useState, useCallback, useEffect } from 'react';-import * as THREE from 'three';--function Model({ url, color }: { url: string; color: string }) {- const { scene } = useGLTF(url);- const groupRef = useRef<THREE.Group>(null);- const [hovered, setHovered] = useState(false);-- const material = useMemo(- () =>- new THREE.MeshStandardMaterial({- color: new THREE.Color(color),- emissive: new THREE.Color(color),- emissiveIntensity: 0.15,- roughness: 0.2,- metalness: 0.8,- wireframe: true,- transparent: true,- opacity: 0.8,- }),- [color],- );-- const coloredScene = useMemo(() => {- const clonedScene = scene.clone();- clonedScene.traverse((child) => {- if (child instanceof THREE.Mesh) {- child.material = material;- }- });- return clonedScene;- }, [scene, material]);-- useEffect(() => {- return () => {- material.dispose();- coloredScene.traverse((child) => {- if (child instanceof THREE.Mesh) {- child.geometry?.dispose();- }- });- };- }, [material, coloredScene]);-- const handlePointerOver = useCallback(() => {- setHovered(true);- }, []);-- const handlePointerOut = useCallback(() => {- setHovered(false);- }, []);-- useFrame((state, delta) => {- if (!groupRef.current) return;-- const amp = hovered ? 1.8 : 1.2;- const targetRotationX = (-state.pointer.y * Math.PI * amp) / 8;- const targetRotationY = (state.pointer.x * Math.PI * amp) / 8;-- groupRef.current.rotation.x = THREE.MathUtils.damp(- groupRef.current.rotation.x,- targetRotationX,- 4,- delta,- );-- groupRef.current.rotation.y = THREE.MathUtils.damp(- groupRef.current.rotation.y,- targetRotationY,- 4,- delta,- );-- groupRef.current.rotation.z = THREE.MathUtils.damp(- groupRef.current.rotation.z,- Math.sin(state.clock.elapsedTime * 0.4) * 0.08,- 2,- delta,- );-- const targetScale = hovered ? 1.15 : 1.0;- groupRef.current.scale.setScalar(- THREE.MathUtils.damp(groupRef.current.scale.x, targetScale, 6, delta),- );- });-- return (- <group- ref={groupRef}- onPointerOver={handlePointerOver}- onPointerOut={handlePointerOut}- >- <Float speed={2.5} rotationIntensity={0.4} floatIntensity={0.8}>- <PresentationControls- global- rotation={[0.13, 0.1, 0]}- polar={[-0.4, 0.2]}- azimuth={[-1, 0.75]}- snap={true}- >- <Center>- <primitive object={coloredScene} scale={1.2} />- </Center>- </PresentationControls>- </Float>- </group>- );-}--export function GlbViewer({ src }: { src: string }) {- return (- <Canvas- camera={{ position: [0, 0, 6], fov: 45 }}- style={{ width: '100%', height: '100%', cursor: 'pointer' }}- dpr={[1, 1.5]}- frameloop="demand"- gl={{- antialias: true,- alpha: true,- powerPreference: 'low-power',- }}- >- <ambientLight intensity={0.6} />- <directionalLight position={[10, 10, 5]} intensity={2.5} color="#ffffff" />- <directionalLight- position={[-10, -10, -5]}- intensity={1.5}- color="#120AF2"- />- <spotLight- position={[0, 5, 10]}- intensity={2.5}- penumbra={0.8}- color="#ffffff"- angle={0.6}- />- <Suspense fallback={null}>- <Model url={src} color="#120AF2" />- </Suspense>- </Canvas>- );-}\ No newline at end of filediff --git a/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCard.tsx b/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCard.tsxindex b95f59f8d49..bb24cf6cf76 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,15 +1,10 @@-import {- Body,- Heading,- IconButton,- LazyEmbed,-} from '@/design-system/components';+import { Body, Heading, IconButton } from '@/design-system/components';import { ArrowRightIcon } from '@/icons';import type { ThreeCardsIllustrationCardType } from '@/sections/ThreeCards/types';import { theme } from '@/theme';import { styled } from '@linaria/react';+import { IllustrationCardVisual } from './IllustrationCardVisual';import { ThreeCardsCardShape } from './CardShape';-import { GlbViewer } from './GlbViewer';const IllustrationCardContainer = styled.div`position: relative;@@ -91,17 +86,10 @@ export function IllustrationCard({/><CardRule /><CardEmbed>- {illustrationCard.illustration.src.endsWith('.glb') ? (- <GlbViewer src={illustrationCard.illustration.src} />- ) : (- <LazyEmbed- src={illustrationCard.illustration.src}- title={illustrationCard.illustration.title}- allow="clipboard-write; encrypted-media; gyroscope; web-share"- referrerPolicy="strict-origin-when-cross-origin"- allowFullScreen- />- )}+ <IllustrationCardVisual+ src={illustrationCard.illustration.src}+ title={illustrationCard.illustration.title}+ /></CardEmbed><CardRule /><CardBodyCell>diff --git a/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCardVisual.tsx b/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCardVisual.tsxnew file mode 100644index 00000000000..8f185c99800--- /dev/null+++ b/packages/twenty-website-new/src/sections/ThreeCards/components/IllustrationCard/IllustrationCardVisual.tsx@@ -0,0 +1,330 @@+'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 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.illustrationCardVisualRest = rest;+ });+}++const StyledVisualMount = styled.div`+ display: block;+ height: 100%;+ min-width: 0;+ width: 100%;+`;++export type IllustrationCardVisualProps = {+ src: string;+ title: string;+};++export function IllustrationCardVisual({+ src,+ title,+}: IllustrationCardVisualProps) {+ 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 clock = new THREE.Clock();++ const loader = new GLTFLoader();+ loader.load(+ 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 = 2.75 / 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.illustrationCardVisualRest 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);+ }+ };+ }, [src]);++ return (+ <StyledVisualMount aria-label={title} ref={mountReference} role="img" />+ );+}