Question about Javis.jl

Hello, @sudomaze I’m following tutorial 1: Making Your First Javis Animation. However, I do not understand this error warning.

myvideo = Video(500,500)
Background(1:70, ground)
red_ball = Object(1:70, (args...) -> object(0,"red"), Point(100,0))

render(
    myvideo;
    pathname="circle.gif"
)
MethodError: no method matching arc(::Cairo.CairoContext, ::Int64, ::Int64, ::Symbol, ::Int64, ::Float64)
Closest candidates are:
  arc(::Cairo.CairoContext, ::Real, ::Real, !Matched::Real, ::Real, ::Real) at C:\Users\adeil\.julia\packages\Cairo\smWIA\src\Cairo.jl:711
  arc(::Graphics.GraphicsContext, ::Real, ::Real, !Matched::Real, ::Real, ::Real) at none:0

Stacktrace:
 [1] circle(::Int64, ::Int64, ::Symbol, ::Symbol) at C:\Users\adeil\.julia\packages\Luxor\Sul91\src\curves.jl:15
 [2] circle(::Int64, ::Int64, ::Symbol) at C:\Users\adeil\.julia\packages\Luxor\Sul91\src\curves.jl:12
 [3] object(::Int64, ::String) at .\In[28]:3
 [4] (::var"#9#10")(::Video, ::Vararg{Any,N} where N) at .\In[29]:3
 [5] draw_object(::Object, ::Video, ::Int64, ::Array{Float64,2}) at C:\Users\adeil\.julia\packages\Javis\ArqyR\src\Javis.jl:342
 [6] macro expansion at C:\Users\adeil\.julia\packages\Javis\ArqyR\src\Javis.jl:289 [inlined]
 [7] macro expansion at C:\Users\adeil\.julia\packages\Luxor\Sul91\src\basics.jl:503 [inlined]
 [8] get_javis_frame(::Video, ::Array{Javis.AbstractObject,1}, ::Int64) at C:\Users\adeil\.julia\packages\Javis\ArqyR\src\Javis.jl:288
 [9] macro expansion at C:\Users\adeil\.julia\packages\Javis\ArqyR\src\Javis.jl:219 [inlined]
 [10] macro expansion at C:\Users\adeil\.julia\packages\ProgressMeter\poEzd\src\ProgressMeter.jl:754 [inlined]
 [11] render(::Video; framerate::Int64, pathname::String, liveview::Bool, tempdirectory::String, ffmpeg_loglevel::String) at C:\Users\adeil\.julia\packages\Javis\ArqyR\src\Javis.jl:218
 [12] top-level scope at In[29]:5
 [13] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

I have already installed Cairo.jl and Luxor.jl, buti didn’t get successful. How should I proceed?

Use O rather than 0, perhaps. The 0 should have a slash through it; the O doesn’t.

Okay, I did what you advised. Thank you. the output does not show the image.

Is the problem now that I’m at Jupyter? I’ll try the REPL.

Yes each environment you use has different abilities with regard to displaying results such as images and animations. Perhaps ask at Javis HQ for guidance as regards Jupyter.

1 Like

Thank you very much.

Best regards.

Even in Julia REPL the result was the same.

julia> render(
           myvideo;
           pathname="circle.gif"
       )
Rendering frames...100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| Time: 0:00:05
"circle.gif"

@Wikunia,

What can I do to get the image on the screen?

1 Like

The circle is rendered to the file circle.gif You need to check it out with an image viewer or something like that. If you want to have a live view of the animation you can use:

render(myvideo; pathname="circle.gif", liveview=true)

We are currently working on a solution to display it inside Jupyter and Pluto notebooks.

2 Likes

@Wikunia, should this code snippet show the animation on my screen or should I write it another way?

julia> act!(red_ball, Action(anim_rotate_around(2Ο€,O), liveview=true))
ERROR: MethodError: no method matching Action(::Javis.Rotation{Float64}; liveview=true)
Closest candidates are:
  Action(::Union{Function, Javis.AbstractTransition}; keep) at C:\Users\adeil\.julia\packages\Javis\ArqyR\src\structs\Action.jl:75 got unsupported keyword argument "liveview"
  Action(::Any, ::Union{Javis.ReversedEasing, Animations.Easing}, ::Function; keep) at C:\Users\adeil\.julia\packages\Javis\ArqyR\src\structs\Action.jl:78 got unsupported keyword argument "liveview"
  Action(::Any, ::Union{Javis.ReversedEasing, Animations.Easing}, ::Javis.Translation; keep) at C:\Users\adeil\.julia\packages\Javis\ArqyR\src\structs\Action.jl:81 got unsupported keyword argument "liveview"
  ...
Stacktrace:
 [1] kwerr(::NamedTuple{(:liveview,),Tuple{Bool}}, ::Type{T} where T, ::Javis.Rotation{Float64}) at .\error.jl:157
 [2] top-level scope at REPL[26]:1

No you can only apply liveview=true to the render function.
I’m not sure what you mean it should do in your example.

Okay, I’m going to go after I write the code, where do I see the animation?

julia> act!(red_ball, Action(anim_rotate_around(2Ο€, O)))
4-element Array{Javis.AbstractAction,1}:
 Action(Javis.Frames{Symbol}(nothing, :same), Animations.Animation{Float64}(Animations.Keyframe{Float64}[Animations.Keyframe{Float64}(0.0, 0.0), Animations.Keyframe{Float64}(1.0, 6.283185307179586)], Animations.Easing{Animations.FuncEasing}[Animations.Easing{Animations.FuncEasing}(Animations.FuncEasing(Animations.f_linear, ()), 1, false, 0.0, 0.0)]), Javis.var"#52#53"{Point}(Point(0.0, 0.0)), nothing, true, Dict{Symbol,Any}())
 Action(Javis.Frames{Symbol}(nothing, :same), Animations.Animation{Float64}(Animations.Keyframe{Float64}[Animations.Keyframe{Float64}(0.0, 0.0), Animations.Keyframe{Float64}(1.0, 6.283185307179586)], Animations.Easing{Animations.FuncEasing}[Animations.Easing{Animations.FuncEasing}(Animations.FuncEasing(Animations.f_linear, ()), 1, false, 0.0, 0.0)]), Javis.var"#52#53"{Point}(Point(0.0, 0.0)), nothing, true, Dict{Symbol,Any}())
 Action(Javis.Frames{Symbol}(nothing, :same), Animations.Animation{Float64}(Animations.Keyframe{Float64}[Animations.Keyframe{Float64}(0.0, 0.0), Animations.Keyframe{Float64}(1.0, 6.283185307179586)], Animations.Easing{Animations.FuncEasing}[Animations.Easing{Animations.FuncEasing}(Animations.FuncEasing(Animations.f_linear, ()), 1, false, 0.0, 0.0)]), Javis.var"#52#53"{Point}(Point(0.0, 0.0)), nothing, true, Dict{Symbol,Any}())
 Action(Javis.Frames{Symbol}(nothing, :same), Animations.Animation{Float64}(Animations.Keyframe{Float64}[Animations.Keyframe{Float64}(0.0, 0.0), Animations.Keyframe{Float64}(1.0, 6.283185307179586)], Animations.Easing{Animations.FuncEasing}[Animations.Easing{Animations.FuncEasing}(Animations.FuncEasing(Animations.f_linear, ()), 1, false, 0.0, 0.0)]), Javis.var"#52#53"{Point}(Point(0.0, 0.0)), nothing, true, Dict{Symbol,Any}())

Currently you build the animation. It needs to be rendered in order to see the gif.

Please, how do I do that?

myvideo = Video(500, 500)
Background(1:70, ground)
red_ball = Object(1:70, (args...) -> object(O, "red"), Point(100,0))
blue_ball = Object(1:70, (args...) -> object(O, "blue"), Point(200,80))
# you can add all `act!`s here

render(
    myvideo;
    liveview=true
)

Sorry I think we confuse each other. The last line should always call render either to a file with pathname or with liveview=true to get a live viewer.

1 Like

I refer to this step in the tutorial.

How do I make the animation appear on my screen?

As it says: The render function stays the same for the rest of this tutorial. So you still need that.

myvideo = Video(500, 500)
Background(1:70, ground)
red_ball = Object(1:70, (args...) -> object(O, "red"), Point(100,0))
act!(red_ball, Action(anim_rotate_around(2\pi, 0)))

render(
    myvideo;
    liveview=true
)

I think there’s something wrong with software. I had already done this, but a static image of the red ball appears.

julia> act!(red_ball, Action(anim_rotate_around(2Ο€,O)))
1-element Array{Javis.AbstractAction,1}:
 Action(Javis.Frames{Symbol}(nothing, :same), Animations.Animation{Float64}(Animations.Keyframe{Float64}[Animations.Keyframe{Float64}(0.0, 0.0), Animations.Keyframe{Float64}(1.0, 6.283185307179586)], Animations.Easing{Animations.FuncEasing}[Animations.Easing{Animations.FuncEasing}(Animations.FuncEasing(Animations.f_linear, ()), 1, false, 0.0, 0.0)]), Javis.var"#52#53"{Point}(Point(0.0, 0.0)), nothing, true, Dict{Symbol,Any}())

julia> render(
           myvideo;
           liveview=true
       )
"Live preview started."

Have you moved the slider?

2 Likes

I hadn’t done that. Now I’ve seen it. I am a high school physics teacher in Brazil. I’m migrating from python (Vpython) to Julia and I think Javis.jl is a great option. I’m migrating from python (Vpython) to Julia and I think Javis.jl is a great option. Costumo do simulations like this with my students Queda_livre_simples.
When we return to face-to-face classes I intend to teach Julia to my students.

1 Like

Glad I was able to help you out. Currently everything is completely 2D in Javis. Hope that isn’t a problem

2 Likes

Thank you so much for your help. One detail, the program is running on Jupyter. With regard to being in 2D, there’s no problem with that.