Hacker News new | ask | show | jobs
by nyan_sandwich 4299 days ago
Excellent.

It looks like it uses linear interpolation between the different glyphs, which makes it look a bit jerky. The author might want to try a sinusoidal interpolation so that velocity reaches zero at the key frames and the whole thing thus spends more time dwelling on the legible parts of the animation and looks smoother.

2 comments

One trick I've noticed to make animations/transitions "snappier" and more natural is to use quadratic/square (power of 2) scaling. For fun I did it on this clock just saving it locally - you can do it by modifying line 140 of `bezier_clock.pde` to square the ratio instead of simply assign it:

    animationRatio = ratio * ratio;  // can also replace with sqrt(ratio)
Again, just makes it a little bit 'snappier' (remember you have to hit spacebar to turn on continual animation), and scales it so you can determine the numbers a bit more clear earlier in the cycle because of the scaling on (0.0, 1.0]. This is certainly a fun piece of code to play with.
I've updated it with quad, cubic and sinusoidal modes. They all look good. Only problem is that because it's no longer linear, the various points can change at different rates and thus create 'kinks' in the curve. When it's linear, the 'line points' and the associated 'control points' are always in a line locally tangential to the curve (don't know the proper terminology but hopefully you understand).
That shouldn't happen if you do the motion transform uniformly on all axes. It should just be equivalent to changing the speed of time, rather than actually changing the trajectories.
There are many interesting easing functions to play with, primarily due to Robert Penner:

http://www.robertpenner.com/easing/

Cool. That's actually fun to try out. http://plnkr.co/edit/JybIMrHpUzGyr39cV5oz?p=preview
Where did you find bezier_clock.pde to modify? I would like to try a few things as well.
ah right ... my webprogramming is a bit lacking

edit: thanks

Or, y'know, a cubic Bezier interpolation.