Dynamics.js, a JavaScript library to create physics-based animations
dynamicsjs.com
dynamicsjs.com
x''(t) = -2a * x'(t) - k * x(t)
(spring force k, linear friction a), the solution is generally a sum of solutions x = C exp(w t) for some arbitrary constant C and w = w(a, k). Plugging this in produces: w^2 + 2 a w + k = 0
(w + a)^2 + k - a^2 = 0
w = -a ± sqrt(a^2 - k)
For `k > a^2`, the system is "underdamped" and you see sinusoidal oscillations, and increasing `a` will make the system relax to equilibrium faster. But for `k < a^2`, the system is "overdamped" and increasing `a` will make the system relax slower. (If you find this hard to imagine, think about what happens as `a` tends to infinity: there is so much friction that the spring just barely crawls to its final destination. Comparisons involving molasses and other high-viscosity substances might be apt.When turning the frequency all the way down, I couldn't find a point where the friction started to make the relaxation to equilibrium slower rather than faster.
Edit: that being said, it looks like in the heavily damped case it takes much less than the full duration to finish. That is probably a bug.
Demo: http://daneden.github.io/animate.css/
Of course there's always a the danger of "overdoing it" w/ ridiculous animations but if you can avoid that temptation it's a very handy tool.
It's a definite WIP so any thoughts / ideas / opinions are welcome: Gabrielmtn+github@gmail.com
Where should animation libraries be used? I'd think they should be used where a user would appreciate an animation. Such places could be while waiting for something to load, or maybe on a website dedicated to animation libraries. I think that would be an appropriate place for animations. It'd be weird if a website dedicated to animations didn't have animations on it.
As a sidenote.. I'm currently working on a patch to CyanogenMod 12.1 that allows you turn off fancy animations (such option exists already when you turn on power save mode)
But generally I agree, animations are easily overused. They're quite useful for showing (and sometimes hiding) UI elements, as this leads to a interface devoid of shock and surprise. Heck, I think I read something about that in a paper that predates the web…
Last bit is interesting, animation can convey useful information, but mostly they're attention grabber. They have a place, but care is required.
[0] Source: https://en.wikipedia.org/wiki/Sic
Animations for the sake of having animation is really distracting. But if used subtly and with purpose, they could help enhance the user experience.
I think it's the right direction, though; animating to subtly direct user attention to the right place.
Don't get me wrong, I feel like a lot of animation is unnecessary but if you did what Hacker News advised every webpage would look the same in Lynx as it does in Chrome. Animations can serve a purpose - to focus the user's eye, to give them a sense of where something is going to and from, etc. etc.
They're not universally bad, and this is a fascinating library - it deserves more credit than "animations are bad".
(BTW- This is great work, I just hope UI devs don't overdo it...)
https://developer.apple.com/library/ios/documentation/UIKit/...:
As well as a full-on physics with collisions, etc:
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.
If it is, then I suppose I'll agree it's physics based.
very nice read.
with (context) {
beginPath();
moveTo(100, 100);
lineTo(100, 300);
lineTo(300, 300);
closePath();
stroke();
}Well, you shouldn't use it anyways since it's confusing/ambiguous and it's also terrible for performance.
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
This has been under very active development for going on 3 years now, and it is just starting to get to the point where it can stop being called a prototype or experiment.
"Chrome-based" would be more accurate because it doesn't even work in the latest Firefox.
Also, it contains a full page rant on why Firefox is bad (because of something about Netscape and AOL -- apparently it's still 1995).
If you're going to call it "web-based" try targeting more than 1 browser regardless of your personal beliefs.