We're now into the complete-and-stabilize phase of the 4.5 development cycle, so things are settling in a bit more and blogging about some of the features becomes easier. I'm writing an article for publication on TheDot about the new activities features that we're working on, but I also wanted to say something about another feature set that's not quite so user-visible: using Javascript for animations.
A set of animations is provided in the Plasma library which build on top of the Qt Kinetic animation system. Qt Kinetic is really a fairly "low-level" set of classes for defining animation timelines and having them push and pull various values around on a curve. To avoid a lot of duplication of implementation for things like "an animation that fades an item on the canvas out" as well as to provide some more semantics based options such as "make something appear", libplasma provides a way to access such animations as well as some additional curves via the Animator class. In previous releases, prior to Qt Kinetic, Animator was the animation engine. Now it's essentially a factory for animations.
When I first decided, pre-KDE SC 4.0, that libplasma should provide a way to animate things one of the things I wanted to do was to allow different Plasma applications, plugins and themes to either add new animations or define and alter existing ones. Zack may even remember that conversation from my living room a few years back. :)
We ended up delaying work on that when we found out that Qt Kinetic was in development. Now that we have both Qt Kinetic and good support for it in libplasma, we could move on to realizing that part of the vision.
At Tokamak 4, we decided to try out the concept of driving animations with Javascript. Why? Well, here were our use cases that we needed to fulfill:
To avoid coming up with three different solutions or tying the platform-neutral themes and scripted Plasmoids to C++ plugins, Javascript via QtScript seemed like a good option to explore. After an afternoon design session at Tokamak 4 between myself, Marco, Adenilson and Igor, Adenilson started in on an implementation. I helped out with some of the scripting approach and integration with libplasma while Adenilson kept an eye on performance issues, as he documented on his blog here and here. Our biggest concern was: would it be performant enough, would the overhead be low enough? Turns out that it was, and we now have a solution that covers all our cases elegantly.
In KDE SC 4.5, both Plasma applications as well as desktop themes can define animations using Javascript. With a bit more internal work in libplasma, Plasmoids will also be able to do the same. This is a really interesting alternative to lightweight plugins that extend core functionality in an platform-independent way. To date, we've been using QtScript mostly for adding features on top of Plasma applications, but now we're harnessing it to provide feature sets within libplasma itself.
A set of animations is provided in the Plasma library which build on top of the Qt Kinetic animation system. Qt Kinetic is really a fairly "low-level" set of classes for defining animation timelines and having them push and pull various values around on a curve. To avoid a lot of duplication of implementation for things like "an animation that fades an item on the canvas out" as well as to provide some more semantics based options such as "make something appear", libplasma provides a way to access such animations as well as some additional curves via the Animator class. In previous releases, prior to Qt Kinetic, Animator was the animation engine. Now it's essentially a factory for animations.
When I first decided, pre-KDE SC 4.0, that libplasma should provide a way to animate things one of the things I wanted to do was to allow different Plasma applications, plugins and themes to either add new animations or define and alter existing ones. Zack may even remember that conversation from my living room a few years back. :)
We ended up delaying work on that when we found out that Qt Kinetic was in development. Now that we have both Qt Kinetic and good support for it in libplasma, we could move on to realizing that part of the vision.
At Tokamak 4, we decided to try out the concept of driving animations with Javascript. Why? Well, here were our use cases that we needed to fulfill:
- Desktop themes may want different animations; for instance, one theme may wish for a Plasmoid to spin and grow when it appears instead of grow and pulse.
- Different Plasma Workspace shells may have different needs: Plasma Desktop may want something more eye catchy and can afford to spend more CPU cycles, while Plasma Mobile may not.
- A scripted Plasmoid may wish to provide additional animations for its own use and distribute them as part of the package.
To avoid coming up with three different solutions or tying the platform-neutral themes and scripted Plasmoids to C++ plugins, Javascript via QtScript seemed like a good option to explore. After an afternoon design session at Tokamak 4 between myself, Marco, Adenilson and Igor, Adenilson started in on an implementation. I helped out with some of the scripting approach and integration with libplasma while Adenilson kept an eye on performance issues, as he documented on his blog here and here. Our biggest concern was: would it be performant enough, would the overhead be low enough? Turns out that it was, and we now have a solution that covers all our cases elegantly.
In KDE SC 4.5, both Plasma applications as well as desktop themes can define animations using Javascript. With a bit more internal work in libplasma, Plasmoids will also be able to do the same. This is a really interesting alternative to lightweight plugins that extend core functionality in an platform-independent way. To date, we've been using QtScript mostly for adding features on top of Plasma applications, but now we're harnessing it to provide feature sets within libplasma itself.