Skip to content

Commit

Permalink
feat(landing): ScramblesAnimation
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdancho committed Aug 25, 2024
1 parent 64af56f commit 9b185f0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function ResultsAnimationItem(
} as CSSProperties
}
className={cn(
'absolute animate-landing-falling-text whitespace-nowrap rounded-3xl border border-secondary-20 px-6 py-1 text-[0.875rem] text-grey-20',
'animate-landing-features-results absolute whitespace-nowrap rounded-3xl border border-secondary-20 px-6 py-1 text-[0.875rem] text-grey-20',
)}
>
<div className='mb-[-.1em] pt-[.1em]'>{props.children}</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { AnimationItem } from './animations'

export function ScramblesAnimation() {
return (
<div className='relative h-full'>
<AnimationItem
block='scrambles'
shouldRegisterAnimationEnd
className='animate-landing-features-scrambles absolute right-12 top-[40%] whitespace-nowrap text-[2rem] text-grey-20'
>
R' B U L' U' D2 R' U D2 B' U2 D2 L2 F'
</AnimationItem>
</div>
)
}
3 changes: 2 additions & 1 deletion src/features/landing/sections/FeaturesSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Container } from '../../shared/Container'
import { LeaderboardIcon, ResultIcon, ScrambleIcon, ShareIcon } from '../../shared/icons'
import { AnimationsController, BlockIntersectionWrapper, AnimationItem } from './animations'
import { ResultsAnimation } from './ResultsAnimation'
import { ScramblesAnimation } from './ScramblesAnimation'

export type BlockType = 'results' | 'scrambles' | 'leaderboards' | 'sharing'
export function FeaturesSection({ className, id }: { className: string; id: string }) {
Expand All @@ -25,7 +26,7 @@ export function FeaturesSection({ className, id }: { className: string; id: stri
title='Instant scrambles'
description='Get your scrambles without any manual copy-pasting.'
icon={<ScrambleIcon />}
visualization={<FakeAnimation block='scrambles' />}
visualization={<ScramblesAnimation />}
/>
</BlockIntersectionWrapper>
<BlockIntersectionWrapper block='leaderboards'>
Expand Down
9 changes: 7 additions & 2 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default {
top: 'var(--to-top)',
},
},
'landing-falling-text': {
'landing-features-results': {
'0%': {
left: 'var(--from-left)',
top: 'var(--from-top)',
Expand All @@ -100,13 +100,18 @@ export default {
from: { backgroundColor: 'white' },
to: { backgroundColor: 'black' },
},
'landing-features-scrambles': {
from: { clipPath: 'inset(0 100% 0 0)' },
to: { clipPath: 'inset(0 0% 0 0)' },
},
},
animation: {
'accordion-down': 'accordion-down 0.2s ease-out',
'accordion-up': 'accordion-up 0.2s ease-out',
'landing-alternating-text': 'landing-alternating-text 6s linear infinite',
'landing-blobs': 'landing-blobs 20s linear infinite',
'landing-falling-text': 'landing-falling-text linear 3s forwards',
'landing-features-results': 'landing-features-results linear 3s forwards',
'landing-features-scrambles': 'landing-features-scrambles linear 2.7s forwards',
fake: 'fake linear 3s forwards',
},
spacing: {
Expand Down

0 comments on commit 9b185f0

Please sign in to comment.