# Makie Animation

**URL:** <https://discourse.julialang.org/t/makie-animation/72869>\
**Category:** General Usage\
**Created:** [December 10, 2021, 1:05am UTC](https://discourse.julialang.org/t/makie-animation/72869 "2021-12-10T01:05:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vahhab70](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@vahhab70](https://discourse.julialang.org/u/vahhab70)\
**Post date:** [December 10, 2021, 1:05am UTC](https://discourse.julialang.org/t/makie-animation/72869/1 "2021-12-10T01:05:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fgerick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fgerick/32/13228_2.png) [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Post date:** [December 10, 2021, 8:59am UTC](https://discourse.julialang.org/t/makie-animation/72869/2 "2021-12-10T08:59:54Z")

</div>

Welcome!

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

```julia
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](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757). 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).
