Most standard tools for vector graphics/animations(eg: Inkscape, GIMP etc.) follow a layer based approach towards the entire canvas, where different layers are stacked on top of each other(or together in a list).
Layers in Inkscape
A similar feature in Javis could add new capablities to animation with Javis.
But let's pause and ponder over what features we wish, a Javis Layer must have.
Layers can define their own properties such as color, size, frame range etc
Properties will be local for a layer and apply to all the objects in that layer.
Actions defined over a particular object automatically become a part of the layer based on the frame range.
A layer can constitute multiple objects and sub-layers (as children) which inherit the properties of the parent layer. Hence the canvas tends to have a “tree-like” structure.
There are two main challenges to be tackled before layers in Javis becomes a reality:
Every layer should be independent of other layer in the canvas.
This would require every layer to have a separate context(position, size, settings etc.)
One ahould be able to apply actions to each layer.
A simple example is if I want to show the animation of a planet and then move it to some place like the bottom of the canvas.
This needs some out-of-the-box thinking since actions on a layer should be applied to the layer as a whole and not it's constituent objects.
The above challenges become more interesting due to the fact that Javis is based on Luxor which is itself based on Cairo which don't have such context in-built.
Luxor does have some comparable contexts eg: A
Drawing and a
@layer. While a
Drawing is a complete canvas,
@layer seems like the obvious way to go and this holds well al long as each layer is a
AbstractObject. #341 explores this idea. .
After a few trials we ran into a problem with this direct implemenation: While we did have a tree-like structure, we realized that it was applying layer's actions on individual objects rather than the entire layer.
And the output came out someting like:
I was almost about to give up when one of my amazing mentors Jacob Zelko stepped in with his genius and suggested an altogether new way of looking at layers!