javascript animations
Aaron J. Seigo
aseigo at kde.org
Wed Apr 28 20:14:04 CEST 2010
hi ...
we now have themable animation support in libplasma. one of the things we've
been dreaming of since the original Animator class was born has come true,
though there have been a few twists and turns to get here such as Qt Kinetic
appearing and using Javascript for the theming.
here is how it currently works in trunk:
* a desktop theme can include one or more JS scripts in the animations/
subdirectory. each file can contain multiple animation definitions, each of
which must be registered by calling registerAnimation(String name, Function
func) in the script
* in the theme's metadata.desktop file there is a new section supported:
[Animations]. this group must contain mappings between the script name and the
aimations it contains, e.g.:
[Animations]
stockanims.js=ZoomAnimation,PulseAnimation,RotationAnimation
* fallback themes (aka "theme inheritance") is supported for this
* scripted animation registration is "first come, first serve" so until the
theme is changed, animations can not overwrite each other. this should keep
things a sane (e.g. fallback themes won't overwrite existing anim defs)
* Animator::create(const QString &animationName, QObject *parent = 0) will
attempt to create an appropriate JavascriptAnimation, which is just another
QAbastractAnimation ... well, a Plasma::EasingAnimation. same thing ;)
* Coronas can now map stock animations to each other (e.g. make
"DisappearAnimation" mean "ZoomAnimation") as well map stock animations to js
animations. this means that the appear/disappear of Applets in a Containment
are now back to using the correct semantic animations: Appear and Disappear.
it is up to the Corona subclass to take care of mapping those.
what is left to do:
* allow javascript plasmoids to create and call their own animations from
files in the PlasmoidPackage
* allow Coronas to load their own javascript script files (this will bring
back the applet creation animation in plasma-desktop)
*do an audit of the js API for animations to make sure it does everything we
need/want, such as animation groups
* put js versions of the stock anims in the Air theme to make sure it all
works as expected :)
your feedback is wanted since once 4.5 is out, we'll be "stuck" with the
above.
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Qt Development Frameworks
More information about the Plasma-devel
mailing list