Home » Posts

Layers-v2

2021-07-04 · Arsh Sharma

शाश्वतं जीवनम् , अमरं प्रेम ।

Eternal Life, Undying Passion.

Continuing from the previous blog, where my mentor suggested an altogether new approach which involved looking at each layer, not as an Object but as a Drawing.

Credits: Jacob Zelko

What if we treated the layer as it's own rendering process?

#343 encapsulates the above idea!

Here's how this approach works:

for each frame in the video
    if layers exist

    1)  render(the layers as drawings, compute their actions and save their image matrices and settings based 
         on the computed actions)
    
    2)  create(an empty drawing(same size as the main video) and apply the actions on each layer) 
         place(the respective layer's image matrices on the empty drawing)
     end


    3) # finally 
    render(all the independent objects on the main drawing)
    place(the drawing containing all the layers from step two on the main drawing)
end
l1 = @JLayer 10:70 100 100 Point(150, 150) begin
    red_ball = Object(20:60, (args...)->object(O, "red"), Point(50,0))
    act!(red_ball, Action(anim_rotate_around(2π, O)))
end

l2 = @JLayer 71:100 begin
    p = [Point(-1.0, 0.0), Point(1.0, 0.0), Point(0.0, 1.0)]
    Object(40:100, (args...) -> poly(p, :stroke))
end

act!(l1, appear(:fade))
act!(l2, anim_translate(Point(100, 100)))

Layers Gallery

Coming Soon!