Skip to content

Commit

Permalink
feat: motion
Browse files Browse the repository at this point in the history
  • Loading branch information
wkylin committed Dec 26, 2024
1 parent d819f58 commit 5df95d1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/components/stateless/ContentPlaceholder/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ const ContentPlaceholder = () => (
transition={{ duration: 0.8 }}
className={styles.contentPlaceholder}
>
<section>
<Word width={75} />
<Word width={245} />
<Word width={120} />
</section>
{paragraphs.map((words) => (
<Paragraph words={words} />
))}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/home/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ import ShiCode from '@stateless/ShiCode'
// import Masonry from '@container/masonryContainer'
import DynamicBackground from '@stateless/DynamicBackground'
import ContentPlaceholder from '@stateless/ContentPlaceholder'
import { oneApiChat, prettyObject } from '@utils/aidFn'
import { oneApiChat, prettyObject, randomNum } from '@utils/aidFn'

Check warning on line 38 in src/pages/home/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused import

Unused import specifier randomNum
import { fireConfetti } from '@utils/confetti'

import styles from './index.module.less'

const boxCount = Array.apply(null, Array(10))

Check warning on line 43 in src/pages/home/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused local symbol

Unused constant boxCount

const Home = () => {
const [aiText, setAiText] = useState('')
const aiTextRef = useRef(null)
Expand Down
14 changes: 12 additions & 2 deletions src/pages/motion/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useRef } from 'react'
import React, { useState, useRef, useEffect } from 'react'

Check failure on line 1 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

ESLint

ESLint: Install the 'eslint' package
import {
motion,
useAnimationControls,
Expand All @@ -7,6 +7,8 @@ import {
useMotionValueEvent,
useSpring,
useTransform,
useMotionValue,
animate,
} from 'motion/react'
import FixTabPanel from '@stateless/FixTabPanel'
import HorizontalScrollParallax from '@stateless/HorizontalScroll'
Expand Down Expand Up @@ -144,10 +146,18 @@ const ParallaxVert = () => {

const rotate = useTransform(scrollY, [0, 100], [0, 360], { clamp: false })

const count = useMotionValue(10)
const rounded = useTransform(count, (value) => Math.round(value))

useEffect(() => {
const animation = animate(count, 1000, { duration: 10 })
return animation.stop
}, [])

return (
<FixTabPanel ref={scrollRef}>
<h2>Hi, Motion</h2>

<motion.h2>{rounded}</motion.h2>

Check notice on line 160 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.h2
<motion.div

Check notice on line 161 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
position: 'fixed',
Expand Down

0 comments on commit 5df95d1

Please sign in to comment.