diff --git a/src/components/stateless/AnimationTabs/index.jsx b/src/components/stateless/AnimationTabs/index.jsx index d6372db9..2635dfb7 100644 --- a/src/components/stateless/AnimationTabs/index.jsx +++ b/src/components/stateless/AnimationTabs/index.jsx @@ -35,18 +35,18 @@ const AnimationTabs = ({ tabs: propTabs, containerClassName, activeTabClassName, onMouseLeave={() => setHovering(false)} className={clsx('relative px-4 py-2 rounded-full', tabClassName)} style={{ - transformStyle: 'preserve-3d', + transformStyle: 'preserve-3d' }} > {active.value === tab.value && ( )} - {tab.title} + {tab.title} ))} @@ -66,7 +66,7 @@ export const FadeInDiv = ({ className, tabs, hovering }) => { return tab.value === tabs[0].value } return ( -
+
{tabs.map((tab, idx) => ( { scale: 1 - idx * 0.1, top: hovering ? idx * -50 : 0, zIndex: -idx, - opacity: idx < 3 ? 1 - idx * 0.1 : 0, + opacity: idx < 3 ? 1 - idx * 0.1 : 0 }} animate={{ - y: isActive(tab) ? [0, 40, 0] : 0, + y: isActive(tab) ? [0, 40, 0] : 0 }} className={clsx('w-full h-full absolute top-0 left-0', className)} > diff --git a/src/pages/demo/index.jsx b/src/pages/demo/index.jsx index 34fe7105..21e8be6a 100644 --- a/src/pages/demo/index.jsx +++ b/src/pages/demo/index.jsx @@ -7,19 +7,19 @@ const columns = [ title: 'Name', align: 'center', dataIndex: 'name', - width: 150, + width: 150 }, { title: 'Age', align: 'center', dataIndex: 'age', - width: 150, + width: 150 }, { title: 'Address', align: 'center', - dataIndex: 'address', - }, + dataIndex: 'address' + } ] const tabs = [ @@ -27,52 +27,52 @@ const tabs = [ title: 'Product', value: 'product', content: ( -
+

Product Tab

- ), + ) }, { title: 'Services', value: 'services', content: ( -
+

Services tab

- ), + ) }, { title: 'Playground', value: 'playground', content: ( -
+

Playground tab

- ), + ) }, { title: 'Content', value: 'content', content: ( -
+

Content tab

- ), + ) }, { title: 'Random', value: 'random', content: ( -
+

Random tab

- ), - }, + ) + } ] const ProDemo = () => { return ( -
+
diff --git a/src/pages/motion/index.jsx b/src/pages/motion/index.jsx index 26d68982..cb9c6dd8 100644 --- a/src/pages/motion/index.jsx +++ b/src/pages/motion/index.jsx @@ -8,7 +8,7 @@ import { useSpring, useTransform, useMotionValue, - animate, + animate } from 'motion/react' import clsx from 'clsx' import FixTabPanel from '@stateless/FixTabPanel' @@ -18,32 +18,32 @@ import styles from './index.module.less' const animations = { show: { opacity: 1, - filter: 'blur(0)', + filter: 'blur(0)' }, hidden: { opacity: 0, - filter: 'blur(10px)', - }, + filter: 'blur(10px)' + } } const list = { visible: { opacity: 1 }, - hidden: { opacity: 0 }, + hidden: { opacity: 0 } } const item = { visible: { opacity: 1, x: 0 }, - hidden: { opacity: 0, x: -100 }, + hidden: { opacity: 0, x: -100 } } const variantsText = { visible: (i) => ({ opacity: i * 0.3, transition: { - delay: i * 0.3, - }, + delay: i * 0.3 + } }), - hidden: { opacity: 0 }, + hidden: { opacity: 0 } } const btnStyle = { @@ -56,7 +56,7 @@ const btnStyle = { letterSpacing: 1, borderRadius: 20, cursor: 'pointer', - whiteSpace: 'nowrap', + whiteSpace: 'nowrap' } const easeNames = [ 'linear', @@ -69,11 +69,11 @@ const easeNames = [ 'backIn', 'backOut', 'backInOut', - 'anticipate', + 'anticipate' ] const randomSort = (arr) => { - let newArr = [] + const newArr = [] const len = arr.length for (let i = 0; i < len; i++) { const random = Math.floor(Math.random() * arr.length) @@ -108,18 +108,18 @@ const ParallaxVert = () => { const scrollRef = useRef(null) const { scrollYProgress, scrollY } = useScroll({ - container: scrollRef, + container: scrollRef }) const { scrollYProgress: scrYPro, scrollY: scrY } = useScroll({ target: constraintsRef, container: scrollRef, - offset: ['start end', 'end start'], + offset: ['start end', 'end start'] }) const targetRef = useRef(null) const { scrollYProgress: scrYProCard } = useScroll({ target: targetRef, - container: scrollRef, + container: scrollRef // offset: ['start end', 'end start'] }) const scrYProCardX = useTransform(scrYProCard, [0, 1], ['1%', '-50%']) @@ -134,7 +134,7 @@ const ParallaxVert = () => { const scaleX = useSpring(scrollYProgress, { stiffness: 100, damping: 30, - restDelta: 0.001, + restDelta: 0.001 }) const [scrollDirection, setScrollDirection] = useState('down') @@ -165,7 +165,7 @@ const ParallaxVert = () => { const { scrollY: followScrollY } = useScroll({ container: scrollRef, target: followScrollRef, - offset: ['start end', 'end start'], + offset: ['start end', 'end start'] }) const findIndex = (arr, x) => { if (x <= arr[0]) { @@ -227,15 +227,15 @@ const ParallaxVert = () => { backgroundImage: 'linear-gradient(108deg,#0894ff,#ff2e54 70%,#ff9004)', borderRadius: '3px', transformOrigin: 'left', - scaleX: scaleX, + scaleX }} - > + /> { y: 20, // 向下移动20px scale: 0.5, // 缩放至0.5倍 rotate: 45, // 旋转45度 - opacity: 0.5, // 不透明度设置为0.5 + opacity: 0.5 // 不透明度设置为0.5 }} - > + /> sectionPositions[sectionPositions.length - 1] ? 'relative' : 'sticky' }} initial={{ opacity: 1 }} animate={{ - opacity: activeScrollY > sectionPositions[sectionPositions.length - 1] ? 0 : 1, + opacity: activeScrollY > sectionPositions[sectionPositions.length - 1] ? 0 : 1 }} exit={{ opacity: 0 }} > @@ -272,13 +272,13 @@ const ParallaxVert = () => { ref={(el) => (navItemsRef.current[index] = el)} onClick={() => handleNavItemClick(index)} style={{ - transformStyle: 'preserve-3d', + transformStyle: 'preserve-3d' }} > {item} {index === activeNavItemIndex && ( { ))} -
+
{navItems.map((item) => (
{ backgroundColor: '#aaa', borderRadius: '10px', rotate: 0, - x: '200px', + x: '200px' }} - > + /> + initial='hidden' + animate='show' + /> @@ -344,7 +344,7 @@ const ParallaxVert = () => { item3 {['vue', 'react', 'angular'].map((item, i) => ( - + {item} ))} @@ -353,7 +353,7 @@ const ParallaxVert = () => { style={{ display: 'flex', flexDirection: 'column', - gap: 30, + gap: 30 }} > { width: 100, height: 100, backgroundColor: '#aaa', - borderRadius: '20px', + borderRadius: '20px' }} animate={{ - rotate: isRotated ? 45 : 0, + rotate: isRotated ? 45 : 0 }} // 实现鼠标悬浮的效果 whileHover={{ - rotate: 45, + rotate: 45 }} // 实现按住的效果 whileTap={{ backgroundColor: '#000', - scale: 1.2, + scale: 1.2 }} onClick={() => { setRotate(!isRotated) }} - > + />
{/*
{
{ width: 100, height: 100, backgroundColor: '#aaa', - borderRadius: '20px', + borderRadius: '20px' }} transition={{ duration: 2, - ease: 'linear', + ease: 'linear' }} initial={{ - x: -100, + x: -100 }} animate={controller2} onUpdate={(latest) => { @@ -434,17 +434,17 @@ const ParallaxVert = () => { setIsAnimation(false) console.log('Completed animating', definition) }} - > + />
{ await controller2.start({ x: 100 }) @@ -467,7 +467,7 @@ const ParallaxVert = () => { width: 800, height: 400, border: '1px solid #aaa', - margin: '20px auto', + margin: '20px auto' }} ref={constraintsRef} > @@ -484,7 +484,7 @@ const ParallaxVert = () => { position: 'sticky', top: '40px', left: 0, - zIndex: 3, + zIndex: 3 }} > 拖动元素 @@ -494,29 +494,26 @@ const ParallaxVert = () => { width: 100, height: 100, backgroundColor: '#333', - borderRadius: '20px', + borderRadius: '20px' }} animate={controller} whileDrag={{ backgroundColor: '#aaa', - scale: 1.2, + scale: 1.2 }} // drag="x" drag onDragStart={(event, info) => console.log(info.point.x, info.point.y)} onDragEnd={(event, info) => console.log(info.point.x, info.point.y)} onDirectionLock={(axis) => console.log('axis', axis)} - dragSnapToOrigin={true} + dragSnapToOrigin // dragConstraints={{ left: 0, right: 300 }} dragConstraints={constraintsRef} - // dragElastic={false} - // dragElastic={0.8} - // dragPropagation={false} - > + />
{
-
-
- +
+
+
@@ -568,7 +565,7 @@ const ParallaxVert = () => { justifyContent: 'center', flexWrap: 'wrap', alignItems: 'center', - gap: 52, + gap: 52 }} >
{ flexWrap: 'wrap', alignItems: 'center', gap: 32, - marginTop: 230, + marginTop: 230 }} > {easeNames.map((item, i) => { @@ -592,7 +589,7 @@ const ParallaxVert = () => { alignItems: 'center', fontFamily: 'system-ui', gap: 12, - color: 'white', + color: 'white' }} key={i} > @@ -603,11 +600,11 @@ const ParallaxVert = () => { backgroundColor: '#333', borderRadius: '20px', textAlign: 'center', - lineHeight: '100px', + lineHeight: '100px' }} transition={{ duration: 2, - ease: item, + ease: item }} animate={controls} > @@ -621,7 +618,7 @@ const ParallaxVert = () => {
{ display: 'flex', alignItems: 'center', justifyContent: buttonRight ? 'flex-end' : 'flex-start', - padding: 10, + padding: 10 }} onTap={() => { setButtonState(!buttonRight) @@ -665,9 +662,9 @@ const ParallaxVert = () => { width: 60, height: 60, backgroundColor: 'white', - borderRadius: 60, + borderRadius: 60 }} - > + />
scrollDirection: {scrollDirection}
@@ -679,18 +676,18 @@ const ParallaxVert = () => { borderRadius: '20px', // scaleX: scrollYProgress, x, - rotate, + rotate }} - > + /> + />
{ fontFamily: 'system-ui', fontSize: '2rem', fontWeight: 'bold', - marginBottom: 20, + marginBottom: 20 }} > { display: 'flex', flexDirection: 'column', alignItems: 'center', - gap: 10, + gap: 10 }} > {listLabel.map((item) => { @@ -723,7 +720,7 @@ const ParallaxVert = () => { display: 'flex', justifyContent: 'center', alignItems: 'center', - borderRadius: 12, + borderRadius: 12 }} key={item} > @@ -744,7 +741,7 @@ const ParallaxVert = () => { backgroundColor: 'black', color: 'white', letterSpacing: 2, - cursor: 'pointer', + cursor: 'pointer' }} onTap={() => { setListLabel(randomSort(listLabel)) @@ -759,7 +756,7 @@ const ParallaxVert = () => { display: 'flex', flexDirection: 'column', justifyContent: 'center', - alignItems: 'center', + alignItems: 'center' }} > { alignItems: 'center', justifyContent: 'center', padding: 10, - gap: 10, + gap: 10 }} layout > @@ -787,7 +784,7 @@ const ParallaxVert = () => { justifyContent: 'center', alignItems: 'center', fontFamily: 'system-ui', - color: '#000', + color: '#000' }} onTap={() => { setBigState(!isBig) @@ -801,18 +798,18 @@ const ParallaxVert = () => { width: 60, height: 60, backgroundColor: '#fff', - borderRadius: 10, + borderRadius: 10 }} - > + /> + />