This file contains hidden or 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
| /** | |
| Simplified version of https://examples.motion.dev/react/card-stack | |
| **/ | |
| import { motion, useMotionValue, useTransform, animate } from "framer-motion" | |
| function SwipeableCard() { | |
| const x = useMotionValue(0) | |
| const rotate = useTransform(x, [-200, 200], [-25, 25]) |
This file contains hidden or 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
| [vxrn] cleaning | |
| [rerouteNoExternalConfig] delete userViteConfig.ssr.noExternal | |
| ➡ [tamagui] built config and components (161ms) | |
| 🚨 Error applying patch to html-entities | |
| [Error: ENOENT: no such file or directory, open '/Users/matt/Sites/tamagui/node_modules/html-entities/lib/index.js'] { | |
| errno: -2, | |
| code: 'ENOENT', | |
| syscall: 'open', | |
| path: '/Users/matt/Sites/tamagui/node_modules/html-entities/lib/index.js' |
This file contains hidden or 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
| "use client" | |
| import { | |
| frame, | |
| motion, | |
| useMotionValue, | |
| useSpring, | |
| useTransform, | |
| useVelocity, | |
| } from "motion/react" |
This file contains hidden or 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
| import type { ComponentType } from "react" | |
| import { createStore } from "https://framer.com/m/framer/store.js@^1.0.0" | |
| const useStore = createStore({ | |
| myVariant: "A" | |
| }) | |
| export function withSetVariant(Component): ComponentType { | |
| return (props) => { |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"/> | |
| <title>Number.toString() #jsbench #jsperf</title> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
| <script src="./suite.js"></script> | |
| </head> | |
| <body> | |
| <h1>Open the console to view the results</h1> |
This file contains hidden or 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
| <html> | |
| <head> | |
| <title>Pre-generated keyframes performance</title> | |
| <!-- | |
| This file demonstrates that the performance of pre-generated keyframes is poor in Chrome | |
| under surprising circumstances. | |
| Specifically, pre-generated keyframes are fine in isolation. But when combined with a | |
| requestAnimationFrame animation, AND another WAAPI animation, performance becomes | |
| (literally) 100x worse. |
This file contains hidden or 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
| function useGreensock(callback, deps, optionalScope) { | |
| const defaultScope = useRef() | |
| const scope = optionalScope || defaultScope | |
| useLayoutEffect(() => { | |
| const context = gsap.context(callback, scope) | |
| return () => context.revert() | |
| }, deps) | |
This file contains hidden or 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
| 'The animator’s JavaScript toolbox.'.split('').map((character, i) => ( | |
| <TaglineCharacter index={i} key={i} character={character} /> | |
| )) | |
| function TaglineCharacter({ character, index }) { | |
| const ref = useRef(null); | |
| useEffect(() => { | |
| const controls = animate({ | |
| from: 0, |
This file contains hidden or 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
| import { | |
| AnimatePresence, | |
| AnimateSharedLayout, | |
| motion, | |
| useMotionValue, | |
| useIsPresent, | |
| } from "framer-motion"; | |
| import * as React from "react"; | |
| import { useEffect, useRef, useState } from "react"; | |
| import { shuffle } from "lodash"; |
This file contains hidden or 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
| import { useEffect } from "react"; | |
| function handleSpace(event: KeyboardEvent) { | |
| if (event.key === " ") { | |
| event.preventDefault(); | |
| const delta = event.shiftKey ? -window.innerHeight : window.innerHeight; | |
| window.scrollTo(0, window.scrollY + delta); | |
| } | |
| } |
NewerOlder