GithubHelp home page GithubHelp logo

Force update animation about react-move HOT 4 CLOSED

sghall avatar sghall commented on May 21, 2024
Force update animation

from react-move.

Comments (4)

sghall avatar sghall commented on May 21, 2024

Hey, yeah, totally doable.

React-move is listening for your data to change:

https://github.com/react-tools/react-move/blob/999927532ca5be90fc8a54656c41fa2d9b8848eb/src/NodeGroup/NodeGroup.js#L58

So just send a new data array with the new layout when you want to update. For what you're trying to do, I wouldn't use the scales directly in NodeGroup component like the example. Do all the calculation outside and pass it in. If the data values change update your array...if the browser size changes update your array.

from react-move.

markov00 avatar markov00 commented on May 21, 2024

Ok, but what about animate an svg path?
Can I animate directly the d attribute passing a new, precomputed d path?

from react-move.

sghall avatar sghall commented on May 21, 2024

Sure. Absolutely. The value you are interpolating just gets handed off to d3-interpolate.

If the name of your key is "transform" it is interpolated as an SVG tranform:
https://github.com/d3/d3-interpolate#interpolateTransformSvg

Otherwise it goes to interpolate:
https://github.com/d3/d3-interpolate#interpolate

So if your value is a string path it will get interpolated by:
https://github.com/d3/d3-interpolate/blob/master/README.md#interpolateString

Which looks for number inside strings and interpolates them.

from react-move.

markov00 avatar markov00 commented on May 21, 2024

Great thanks for the info.

from react-move.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.