News for hackers. Stuff that matters.
Re:Mo.js – motion graphics for the web by lobster_johnson on Friday November 20, 2015 @08:18PM (#10605004)
As always with front-end libraries these days, my first question is: Does it play nice with React?
Re:Mo.js – motion graphics for the web by zackify on Friday November 20, 2015 @08:58PM (#10605140)
let's just make a wrapper :D
Re:Mo.js – motion graphics for the web by lobster_johnson on Friday November 20, 2015 @09:02PM (#10605161)
React generally requires more than just a wrapper, since its virtual DOM is populated in a highly controlled manner that libraries need to follow. But you can try.
Re:Mo.js – motion graphics for the web by btown on Friday November 20, 2015 @10:12PM (#10605367)
Actually it's pretty trivial. You can always just have your render function be just a static div, set a ref to the div, and do setup in componentDidMount and updates in componentWillUpdate. Since the render function will always return a trivially identical subtree, it will never change that DOM node. Of course, if your component moves in the HTML hierarchy, your animation may restart, but that's unlikely in most use cases.
Re:Mo.js – motion graphics for the web by lobster_johnson on Saturday November 21, 2015 @01:17AM (#10605895)
Depends. Animation tends to be about transitions, so you want to transition between elements. For that you need to handle the virtual DOM.

Twitter's Velocity [1] wrapper is an example of something that works like this, though the authors admit their solution is not idiomatic React.

[1] https://github.com/twitter-fabric/velocity-react#readme

Re:Mo.js – motion graphics for the web by nkozyra on Friday November 20, 2015 @09:32PM (#10605262)
As opposed to, say, server-side graphical libraries for the web?
Re:Mo.js – motion graphics for the web by lobster_johnson on Friday November 20, 2015 @09:39PM (#10605284)
Well, yes.
Re:Mo.js – motion graphics for the web by nkozyra on Friday November 20, 2015 @10:53PM (#10605482)
I'll get right on that "I generated a jpeg" post then!