Makie Animation

Hello,

I highly appreciate it if anybody helps me. I want to generate an animation using GLMakie. It seems the previous frames remain in the video and frames are not updated.
Any help would be appreciated.

using GLMakie
using MAT
file = matopen(“sample_vrtx_1.mat”)
vrtx=read(file, “vrtx”)
scene=contour(vrtx[1,:,:,:],alpha=0.2,colorrange=[-7,7],colormap=:balance,levels=[-7,7])
record(scene, “kir.mp4”) do io
for i=1:100
dat=vrtx[i,:,:,:]
scene=contour!(dat,alpha=0.2,colorrange=[-7,7],colormap=:balance,levels=[-7,7])
recordframe!(io)
end
end

Welcome!

I usually use a Node to update the scene. This example works for me:

using GLMakie

n=100;

function meshgrid(vx::AbstractVector{T}, vy::AbstractVector{T},
                  vz::AbstractVector{T}) where T
    m, n, o = length(vy), length(vx), length(vz)
    vx = reshape(vx, 1, n, 1)
    vy = reshape(vy, m, 1, 1)
    vz = reshape(vz, 1, 1, o)
    om = fill(1, m)
    on = fill(1, n)
    oo = fill(1, o)
    (vx[om, :, oo], vy[:, on, oo], vz[om, on, :])
end

x = range(0,1,length=n);

X,Y,Z = meshgrid(x,x,x);

vrt = sin.(2pi*X) .+ Y .- Z.^2*(rand()+im*rand());

vrtx = zeros(n,n,n,n)
for i=1:n
	vrtx[i,:,:,:] = real.(vrt.*exp(im*2pi*i/n))
end

dat = Node{Array{Float64,3}}(vrtx[1,:,:,:])

scene=contour(dat,alpha=0.2,colorrange=[-1,1],colormap=:balance,levels=[-0.5,0.5])

record(scene, "/tmp/kir.mp4") do io
	for i=1:n
		dat[]=vrtx[i,:,:,:]
		recordframe!(io)
	end
end

By the way: There are some tips and tricks how to make it easier for others to help you. For example you can format your code and it would be easier if you give an example that works (we don’t have your sample_vrtx_1.mat, needed to run your code).