question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] Animating pure data like Number, string, obj etc.

See original GitHub issue
...
<motion.div>
{num}
</motion.div>

How may I animating { num } from 0 to 100 in 1s?
Is there an existing api to manipulate? please help.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

2reactions
mc-petrycommented, Mar 17, 2020

It’s easy to write something like:

function NumberAnimation() {
  const _content = useRef<HTMLDivElement>(null)
  const handleUpdate = useCallback((v: { to: number }) => {
    _content.current!.innerText = v.to.toFixed()
  }, [])

  return <motion.div
    ref={_content}
    animate={{ from: 0, to: 100 }}
    onUpdate={handleUpdate}
  />
}
1reaction
mattgperrycommented, Feb 20, 2021

You can use animate to perform arbitrary animations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 2: Theory of Operation - Pure Data
Atoms are either numbers or symbols like "+". The text you type into an object box determines how many and what kinds of...
Read more >
Animating Number Counters | CSS-Tricks
Number animation, as in, imagine a number changing from 1 to 2, then 2 to 3, then 3 to 4, etc. over a...
Read more >
PURE DATA - FLOSS Manuals (en)
Pure Data is commonly used for live music performance, VeeJaying, sound effects, composition, audio analysis, interfacing with sensors, using ...
Read more >
PURE DATA
Pure Data is commonly used for live music performance, VeeJaying, sound effects, composition, audio analysis, interfacing with sensors, using ...
Read more >
Pure Data - Wikipedia
Pure Data (Pd) is a visual programming language developed by Miller Puckette in the 1990s for creating interactive computer music and multimedia works....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found