How do I define a custom Action in Javis.jl?


So I’m trying to define a custom animation in Javis. My code is -

using Javis
using Animations
using Colors

function ground(args...)

rotate_anim = Animation(
    [0, 1],
    [0, 2π],

nframes = 30

video = Video(500, 500)
Background(1:nframes, ground)

function change_arrow_head(vid, obj, actn, frame)
    new_x = cos(actn.anim(frame / nframes)) * 141.4213562373095
    new_y = sin(actn.anim(frame / nframes)) * 141.4213562373095
    return Object(obj.frames.frames, (args...) -> arrow(O, Point(new_x, new_y)))

ar = Object(1:nframes, (args...; x = 100, y = 100) -> arrow(O, Point(x, y)))
Object(1:nframes, (args...) -> circle(O, 10, :fill))

act!(ar, Action(1:nframes, rotate_anim, change_arrow_head))

render(video; pathname = "test.gif")

Now I have a few questions -

  1. How do I get the length of the arrow rather than manually inputting it where I define new_x, new_y.
  2. Why aren’t the old arrows being removed? Am I not doing this properly? Is there a way to modify the old arrow rather than defining this new arrow? I’ve only ever animated using Matplotlib and Plots.jl


Here is the resulting GIF