Record video

Hi!

Foremost, I will recommend you to read this PSA on quoting code.

Second, what version of Julia and GLMakie are you running? That code looks outdated. You can look at the documentation for animations. You probably want something base on Observable.

Here is an example of how to use them:

julia> using GLMakie

julia> range = -2π:0.1:2π
-6.283185307179586:0.1:6.216814692820414

julia> mul = Observable(1.0)
Observable{Float64} with 0 listeners. Value:
1.0

julia> xy = lift(mul) do m
           [cos(m*x)*cos(m*y) for x=range, y=range]
       end
Observable{Matrix{Float64}} with 0 listeners. Value:
[1.0 0.9950041652780258 … 0.9861923022788637 0.9977982791785807; 0.9950041652780258 0.9900332889206209 … 0.9812654485325952 0.9928134438899342; … ; 0.9861923022788637 0.9812654485325952 … 0.9725752570740857 0.9840209821530128; 0.9977982791785807 0.9928134438899342 … 0.9840209821530128 0.9956014059317367]

julia> fig, ax, plot = contour(xy)

julia> framerate = 30
30

julia> multplier_iterator = LinRange(1.0, 10.0, 60)
60-element LinRange{Float64, Int64}:
 1.0,1.15254,1.30508,1.45763,1.61017,1.76271,1.91525,2.0678,2.22034,2.37288,…,8.62712,8.77966,8.9322,9.08475,9.23729,9.38983,9.54237,9.69492,9.84746,10.0

julia> record(fig, "cosx_cosy.mp4", multplier_iterator; framerate=framerate) do m
           mul[] = m # update multiplier and so the figure
       end
"cosx_cosy.mp4"
3 Likes