-
-
Notifications
You must be signed in to change notification settings - Fork 869
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing double update listenrs on externall provided motion values (#…
- Loading branch information
1 parent
200c0bd
commit 828b8d9
Showing
4 changed files
with
76 additions
and
15 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
dev/react/src/examples/animate-stress-external-motion-value.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { motion, useMotionValue } from "framer-motion" | ||
|
||
function Box({ i }: { i: number }) { | ||
const rotate = useMotionValue(0) | ||
|
||
return ( | ||
<motion.div | ||
initial={{ rotate: 0 }} | ||
animate={{ rotate: 360 }} | ||
transition={{ duration: 4, repeat: Infinity, ease: "linear" }} | ||
style={{ | ||
rotate, | ||
background: `hsla(${i * 10}, 100%, 50%, 1)`, | ||
width: 100, | ||
height: 100, | ||
}} | ||
/> | ||
) | ||
} | ||
|
||
export const App = () => { | ||
const boxes = Array.from(Array(1000).keys()).map((i) => ( | ||
<Box i={i} key={i} /> | ||
)) | ||
|
||
return ( | ||
<div | ||
style={{ | ||
padding: 100, | ||
width: "100%", | ||
display: "flex", | ||
flexWrap: "wrap", | ||
}} | ||
> | ||
{boxes} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters