Animation support in Krita
Short description: This proposal discusses the scope of animation in Krita and how it can be implemented.
Google Summer Of Code (2013) project proposal for KDE
Name: Somsubhra Bairi
Freenode IRC Nick: somsubhra
IM Service and username: Jabber, somsubhra
Location: Gandhinagar, India (UTC + 5.30)
Proposal Title: Animation support for Krita
Motivation for proposal: Krita, the digital painting and illustration software and a part of the Calligra suite already has a whole lot of beautiful tools and features for creating digital painting from scratch. The tools and features available with Krita can be extended to give support for the creation of animation. Adding animation support plus these existing features will enable Krita to be used in film, animation, storyboarding and games.
Goal: By implementing animation support in Krita, we wish to design an interface which would enable animators to use Krita's existing tools to create graphics which could then be used for creating animation in Krita itself without having to switch to some other tool. The main goals of the project are as follows:
- Create an interface with timeline and layer managers to quickly manipulate frames at different instances of time and in different layers.
- Store the animation in a specific format so that it can be rendered again or played.
- Functionality to play the animation.
- Rendering, exporting and importing of frames
- Add animation specific tools and functionalities like onion-skinning, tweening, etc.
Most of the interface for the animation support would be included in a separate animator docker. The central widget of the docker would be an animation timeline which would control the document's content over time in layers and frames. Each frame represents the state of the stage at a given instance of time. The timeline would have different rows of frame-sets representing different layers of the canvas. There could be different states of the frame: xframe which would have new content, blank frames which would have nothing at all and frames which would continue with the content of the previous xframe. Another important component is the play-head which would control the current view on the stage. The layer manager will have different options for hiding the layers, locking the layers, etc. Other components of the timeline would involve the frame per second(fps) input, the onion-skin option, deleting and inserting frames options, deleting and inserting layers options. A GUI mock-up for the timeline is as follows:
Another important feature is to change the length/duration of the content in a layer. The content could contain one or many xframes (xframes are the frames with new content). Here is a nice mockup by Animtim regarding the same:
It could also be possible to move the content from one layer to another. Here is a video demo regarding the re-sizing of the content as well as inter-layer movement on the timeline implemented till now: http://youtu.be/EuwcElkRs_4
- For on-disk storage of the animation we would require to store every layer and their corresponding xframes(not every frame! But only the frames with new content). This would result in a 2D array sort of structure with layers as a dimension and the xframes as the other. The overall structure of the file would appear like this:
The contents of animation.xml would be like this:
The tricky part in the above solution is to reference the .kra files for rendering the layers of animation(i.e reference just the layer of .kra file to layer of animation). Since we are storing just the xframes for the layer, we will have to reference the file based on the starting and ending frames.
- To render the animation, we will load just the neighboring frames of the current frame for smooth switching and not the entire animation. To render a single frame, we refer to a .kra file in every layer based on the frame-range of that file(i.e to find the frame whose startframe is less than the requested frame but the endframe is greater than the requested frame).
- For playing the animation on-screen, we display the current view based on the startframe and endframe of the frame for every layer and the fps. A blank frame would not be displayed at all. Another option would be to take user input for how many frames are to be played before and after the current frame just like in a Flipbook. Based on that only those user-defined frames would be loaded in memory and played according to the fps value.
- The onion skinning function can be used to compare the previous and the next frames with the current frames. The onion-skinning feature would have an option to control the number of neighboring frames to be displayed and their corresponding opacity. There will a seperate docker dedicated to it.
- Another important feature is adding audio support. In order to add sound support to the animation, we need to have different layers for adding the audio over the frames.
- Adding animation specific functionalities like tweening would involve motion tweening over a straight line or any guide path. So there is a need for a guide layer which would contain the guide path over which the object would display motion tween. Along with this shape tweening may also be implemented. But since this feature is complex and not so useful(as it transpired after the discussions on irc), I would prefer keeping it marked as extra as of now.
- Week 1: Design the timeline view with stuff like frames, frame numbers, etc.Add actions like adding and deleting frames and layers plus create the layer manager.
- Week 2: Create an animator model and controller to control the animator(including frame switching and layer controls) and integrate all the actions into it.
- Week 3:Polish the frame and layer switcher in the timeline, add the playhead and stuff like managing the frames per second(fps).
- Week 4: Design the file format for on-disk storage.
- Week 5: Complete work of on-disk storage plus start on rendering.
- Week 6: Render the animation in the timeline based on the storage.
- Week 7: Play the animation based on the rendering from the storage.
- Week 8: Add functionality of onion-skinning.
- Week 9: Add audio support to animator
- Week 10: Start with motion tweening over a straight path.
- Week 11: Create the motion guide path layer systems for motion tweening plus finish shape tweening
- Week 12: Testing the animator. Polish the existing things. Fix minor bugs and problems
Note: I have my university starting up by the last week of July. So I won't be available full-time from the last week of July but devoting 12 hours a day for coding is manageable.
About me: I am Somsubhra, currently pursuing my Bachelors in Information and Communication Technology from Dhirubhai Ambani Institute Of Information and Communication Technology, Gandhinagar, India. My interests are reading, painting and of course a lot of coding. I started contributing to KDE last year around September after I got inspired by few of my seniors here. I started contributing to Krita shortly after that and also attended the Calligra Sprint in March. I always think that contributing to open source is a great benefit as we get a lot to learn working in the community and it also helps the people using open source softwares. My complete profile can be found here. My github profile is:
Junior jobs link: Here is the link of my profile on Reviewboard: https://git.reviewboard.kde.org/users/somsubhrabairi/