Tuesday, June 21, 2016

Between keyframes

My project this summer started with implementing keyframing for masks and layer opacity. Currently I am doing the same for transformation masks, but in between I worked on the problem of interpolation.

Layer opacity was a good test case for this. To get a smooth transition from one level of transparency to another, one would not want to manually adjust it on every single frame. Instead, we want to be able to specify a curve which the intermediary values follow.

Like most other animation software, our approach is based on cubic Bezier curves. They allow good control over the curve in an intuitive way. In fact, they can even allow a little too much control. Unless we place extra constraints, the curve could double over or form loops. The math for detecting these situations exactly can get quite complex, but luckily there is a simple compromise. If we limiting the control points between the end points on the time axis, the curve will always behave itself.

I have finished implementing the backend portion, and interpolation now works with layer opacity. The work included implementing the math, using the interpolated values in rendering the image and making the animation cache aware of which frames need to be cached separately. Right now it always defaults to a linear transition, as there is no user interface to adjust the curve yet.

We are in the process of designing a visual editor for this with feedback from animators. While the discussion is still ongoing, I believe we have established a good overall design which I can start implementing soon.

Tuesday, May 24, 2016

The work on animation features continues

While the first stable Krita version with animation is just around the corner, I am already rolling up my sleeves with plans to take the feature to the next level. It's Google Summer of Code time again.

A lot has happened since last year. Import for image sequences was added, the timeline docker was reworked and a large number of smaller changes and fixes were implemented to make the animation tools ready for inclusion in Krita 3.0. For a nice overview, check out GDQuest's video tutorial.

More will be coming this summer as I work on my second GSoC project. Firstly, animation capabilities will extend to cover most layer types. I have already started implementing it for masks and filter layers. Keyframing will become available for the filter parameters and layer opacity. However, vector layers will have to wait for now as they are facing major changes in the near future thanks to Krita's Kickstarter campaign this year, which promises to bring much needed updates to the text and vector tools.

Mockup of interpolation curve editor
Secondly, many properties, such as layer opacity, will get options for interpolation between keyframes. These could be used, for example, to animate a smooth fade-out or even do basic cut-out style animation with a transform mask. To control the interpolation, a new curve editor will complement the existing timeline.

There's a lot of work ahead, but I am already looking forward to seeing these features myself.