Live data from Hacker News

Dynamics.js, a JavaScript library to create physics-based animations

dynamicsjs.com

41–49 of 49 posts

Re: Dynamics.js, a JavaScript library to create physics-based animations

#41
post #19

For anyone wanting to do graphics in web pages I would recommend looking into the canvas tag. Example code: with (context) { beginPath(); moveTo(100, 100); lineTo(100, 300); lineTo(300, 300); closePath(); stroke(); }

Since ES5, you can't use `with` in strict mode.

Well, you shouldn't use it anyways since it's confusing/ambiguous and it's also terrible for performance.

Re: Dynamics.js, a JavaScript library to create physics-based animations

#44
post #43

Interesting that the npm is accessed with npm install dynamics.js . Looks like npm install dynamics is a different library. I wonder if we are running out of npm namespace.

Note that npm now has scopes http://blog.npmjs.org/post/116936804365/solving-npms-hard-pr...

Re: Dynamics.js, a JavaScript library to create physics-based animations

#45

Neat. Couldn't this be implemented as a generator of easing functions, allowing the animation code to be handled by another project? http://easings.net/

Many of these effects are impossible with CSS3[1], so Dynamics.js just seems to animate `transform` CSS properties with regular javascript. Definitely nice, but it would be great to have a tool like this spit out real css animations which don't rely on javascript every frame.

[1]: http://easings.net/#easeOutElastic

Re: Dynamics.js, a JavaScript library to create physics-based animations

#47
post #22
post #16

It's a nice library but I'm failing to understand the "physics-based" part. I'm not seeing anything "physics" in the traditional sense; just manipulating the matrix3d in a transform property of an element in real-time to provide difficult or impossible effects with CSS alone.

You don't consider motion based on gravitational and spring-mass models to be an application of physics?

Is they code actually performing physics calculations, or is it a good fake? I can fake much of that behavior with animation keyframes and that doesn't make it physics in my mind.

If it is, then I suppose I'll agree it's physics based.

Re: Dynamics.js, a JavaScript library to create physics-based animations

#48
post #41
post #19

For anyone wanting to do graphics in web pages I would recommend looking into the canvas tag. Example code: with (context) { beginPath(); moveTo(100, 100); lineTo(100, 300); lineTo(300, 300); closePath(); stroke(); }

Since ES5, you can't use `with` in strict mode. Well, you shouldn't use it anyways since it's confusing/ambiguous and it's also terrible for performance.

I wanted to make a point about all the confusing new features of ES6 that are just there to save a few key strokes, and will haunt you forever.

Re: Dynamics.js, a JavaScript library to create physics-based animations

#49

OK so how do I make this control an LFO in my music? ;)

Well, I suppose you could use the Web MIDI API: http://webaudio.github.io/web-midi-api/

Although if you need to route it to an external (non-browser) output, you might consider using OSC. There appear to be multiple implementations, but here's one: https://github.com/marmorkuchen-net/osc-js

Post reply on HN