My blog has been moved to ariya.ofilabs.com.

Tuesday, March 03, 2009

didn't have a choice but to lift you up

QTimeLine is a nice class to control animation [1], used among others in Plasma::Animator. There are some curve shapes available for the timeline, from a linear one to some easing combinations. Though linear gives a rather standard movement effect, using easing often can give a better touch. This makes sense, as everything is our daily life usually moves not in a linear movement, due to e.g. inertia and gravity.

Which brings me to another point. At least for me, the ease in and out curve shapes do not feel as natural as they could be. The solution is to create a custom timeline. This becomes the latest graphics example in our Qt Labs blogs. Basically I use the logistic function (again [2]) for a nice S-shape curve. You can even adjust the sharpness of the S-shape. From the animation (click the Show Panel or Hide Panel button), you might see that the starting part of the curve gives you the feeling of overcoming the inertia of the panel and the friction of the panel to the desktop, while the last part of the curve makes you think as if you release the push force and let the panel slides by itself.

Time to make this as the default curve shape for Plasma? :-)

[1] For Qt 4.6, a new animation framework is planned which is supposed to give a much more flexible animation control.
[2] I used it for the genie effect before.

1 comment:

pebbie said...

kok bezier nggak ada?