11import { useI18n } from "~/context/i18n"
2- import "./logo-fan.css"
32import { A } from "@solidjs/router"
43import { createEffect , createMemo , createSignal , For , on , onCleanup , Show } from "solid-js"
54import { useLanguage } from "~/context/language"
65import { brandAssets } from "~/lib/media"
76import { logoVariantSvgs } from "./logo-variants"
87import { pressIcons } from "./press-icons"
8+ import { fanMotion } from "./fan-motion"
99import { siteSettings } from "./settings"
1010
1111type Position = { x : number ; y : number }
1212
13- // Each item drops a little further than the one above it (12px, then 6px more per item, up to
14- // 42px), so the column cascades without any item travelling far. Items also start a touch small
15- // and turned, and settle square.
16- const drop = ( index : number ) => Math . min ( 12 + index * 6 , 42 )
17- const start = ( index : number ) => `translateY(-${ drop ( index ) } px) rotate(-1deg) scale(0.97)`
18- const rest = "translateY(0px) rotate(0deg) scale(1)"
19- const stagger = 32
20-
21- // A tight damped spring (about 7% overshoot, no visible second settle), sampled for linear().
22- const spring = `linear(${ Array . from ( { length : 48 } , ( _ , index ) => {
23- const t = index / 47
24- const damping = 0.65
25- const frequency = 11
26- const damped = frequency * Math . sqrt ( 1 - damping * damping )
27- const value =
28- 1 -
29- Math . exp ( - damping * frequency * t ) *
30- ( Math . cos ( damped * t ) + ( ( damping * frequency ) / damped ) * Math . sin ( damped * t ) )
31- return index === 47 ? "1" : value . toFixed ( 4 )
32- } ) . join ( ", " ) } )`
33-
34- // The fan's motion, shared with the section menus' fan style (docs-lockup.tsx).
35- export const fanMotion = { start, rest, stagger, spring }
36-
3713/**
3814 * The logo menu's fan option: like a Dock stack in Fan view, each brand asset springs out of the
3915 * logo, one after another, into a straight column of previews, each with its label beside it. The
@@ -90,11 +66,11 @@ export function LogoFan(props: { position?: Position; onSelect: () => void }) {
9066 rows ( ) . forEach ( ( item , index ) => {
9167 const fade = [ ...( rebound ? [ ] : [ { opacity : 0 } ] ) , { opacity : 1 } ]
9268 if ( still ( ) ) return item . animate ( fade , { duration : 150 , easing : "ease-out" } )
93- const timing = { delay : index * stagger , fill : "backwards" as const }
94- item . animate ( [ ...( rebound ? [ ] : [ { transform : start ( index ) } ] ) , { transform : rest } ] , {
69+ const timing = { delay : index * fanMotion . stagger , fill : "backwards" as const }
70+ item . animate ( [ ...( rebound ? [ ] : [ { transform : fanMotion . start ( index ) } ] ) , { transform : fanMotion . rest } ] , {
9571 ...timing ,
9672 duration : 450 ,
97- easing : spring ,
73+ easing : fanMotion . spring ,
9874 } )
9975 item . animate ( fade , { ...timing , duration : 140 , easing : "ease-out" } )
10076 // A lifted shadow while the item drops, settling as it lands.
@@ -112,7 +88,7 @@ export function LogoFan(props: { position?: Position; onSelect: () => void }) {
11288 // A small dip before the items lift and fold back up, bottom item first.
11389 item . toggleAttribute ( "data-lift" , true )
11490 return [
115- item . animate ( [ { transform : start ( index ) } ] , {
91+ item . animate ( [ { transform : fanMotion . start ( index ) } ] , {
11692 delay,
11793 duration : 220 ,
11894 easing : "cubic-bezier(0.5, -0.5, 0.8, 0.3)" ,
0 commit comments