Skip to content

Instantly share code, notes, and snippets.

@mfrancois3k
Forked from netgfx/animatetext.tsx
Created May 10, 2022 04:01
Show Gist options
  • Save mfrancois3k/dbf40e1684b214a9fabf9d5b3e9e2966 to your computer and use it in GitHub Desktop.
Save mfrancois3k/dbf40e1684b214a9fabf9d5b3e9e2966 to your computer and use it in GitHub Desktop.
Framer animate text
import * as React from "react"
import {
Frame,
addPropertyControls,
ControlType,
useMotionValue,
Color,
useAnimation,
animate,
} from "framer"
let r = useMotionValue(0)
let start = r
let end = 100
const [value, setValue] = React.useState(0)
let controls = animate(start, end, {
duration: 1.0,
ease: "linear",
delay: 0.0,
onUpdate: (v) => {
setValue(String(Math.round(v)))
},
onComplete: (v) => {
//console.log(v)
},
})
<Frame
{...rest}
background={invisBG}
style={{
color: "#fff",
}}
>
<div>{value}</div>
</Frame>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment