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.

Babel/TS transform for writing the animation specifications

See original GitHub issue

I am wondering if you considered some sort of transform to go from a subset of Javascript to the declarations. So that something like this:

return @reanimated({
  if (!clockRunning(clock)) {
    state.finished = 0;
    state.velocity = velocity;
    state.position = value;
    config.toValue = dest;
    startClock(clock);
  };
  spring(clock, state, config);
  if (state.finished) { 
    stopClock(clock)
  };
  return state.position;
})

is transformed into:

  return [
    cond(not(clockRunning(clock)), [
      set(state.finished, 0),
      set(state.velocity, velocity),
      set(state.position, value),
      set(config.toValue, dest),
      startClock(clock)
    ]),
    spring(clock, state, config),
    cond(state.finished, stopClock(clock)),
    state.position
  ];

Of course the @reanimated decorator might not be the best idea but I’m asking for general feedback. Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
terrysahaidakcommented, Oct 1, 2019

There are several macro implementations, for example, this one: https://www.npmjs.com/package/reanimated.macro

0reactions
jakub-gonetcommented, Dec 19, 2019

Hi @wokalski,

I don’t think we will officially release some plugin for babel, but we can link to those in docs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My personal awesome list based on GitHub stars
34, FocusOverlay, Library for creating animated overlays on focused ... 43, spec-md, Additions to Markdown for writing specification ...
Read more >
Anatomy, Anatomists, and English Poetry 1570-1680 ... - CORE
Imagined as a new Apollo, a heroic discoverer, his strangest transformation is that whereby he is imagined as the micro- cosmic voyager and...
Read more >
Untitled
Business cards font size, Goldvish geneve revolution price, Psds to html, ... Mihai voiculescu constructii, Nokia 101 no power ways, Love stage anime...
Read more >
The heart of Holland - Wikimedia Commons
What an animated scene was that ! the ... admirer of tlie prosperous city, might write, unchal- ... while we turn over some...
Read more >
Bodies by Art Fashioned: Anatomy, Anatomists, and English ...
writing to reveal poetic accounts of the human body to be indebted to ... "General Rules For an Anatomy" which accompanied his notes...
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