Closed wsrinin closed 3 years ago
I found the solution to this but I still would love to have a comment on what went wrong with the above
record(scene, "test.gif") do io
for t = 1:11
scene = lines(range(t, stop = t+10, length=50), f.(range(t, stop=10+t, length=50), t))
display(scene)
sleep(1/10)
recordframe!(io) # record a new frame
end
end
You best don't insert any plots inside record... Updating the limits is what you're missing:
mytime = Node(0.0)
main = Scene(resolution = (500, 500))
layer = Scene(main, IRect(50, 50, 400, 400))
f(x, t) = sin.(x)
x = lift(t -> range(t, stop = t+10, length=50), mytime)
xlim = lift(t -> FRect(t, 0, t+10, 10), mytime)
lines!(layer, x, lift(t -> f.(range(t, stop=10+t, length=50), t), mytime), limit = xlim )
record(main, "test.gif", range(0, stop = 100, length = 100)) do i
push!(mytime, i)
AbstractPlotting.update_limits!(layer)
AbstractPlotting.update!(main)
end
Hi,
I have trouble understanding the results of the following code in particular why does the function record does not do what it is supposed to do. My problem is I would like to dynamically view and video recorder part of the plot as a function of time. Here is a simple example
Now it seems that the code before the record do what I want it to do except that when I manually push
push!(mytime, i)
I have to run this linelines!(layer, x, lift(t -> f.(range(t, stop=10+t, length=50), t), mytime), limit = xlim )
in order to see the plot i.e.push!(mytime, i)
does not automatically update the scene. The result of the recorde function is even worse.What can I do to fix this issue?
Best,