# WGLMakie animations?

**URL:** <https://discourse.julialang.org/t/wglmakie-animations/52084>\
**Category:** Visualization\
**Tags:** plotting\
**Created:** [December 19, 2020, 10:06am UTC](https://discourse.julialang.org/t/wglmakie-animations/52084 "2020-12-19T10:06:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [December 19, 2020, 10:06am UTC](https://discourse.julialang.org/t/wglmakie-animations/52084/1 "2020-12-19T10:06:51Z")

</div>

Hi,

I use (GL)Makie for animations. When I replace `using GLMakie` with `using WGLMakie` its fails:

```julia
 ERROR: type GenericIOBuffer has no field io

```

Is it possible to display animations via WGLMakie ? Is there an example available ?

Thank you for your help.  
Laurent

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [December 19, 2020, 12:12pm UTC](https://discourse.julialang.org/t/wglmakie-animations/52084/2 "2020-12-19T12:12:05Z")

</div>

I think I fixed that in the most recent release. In general, it helps a ton, if you can post a small example to reproduce the error

---

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [December 19, 2020, 1:39pm UTC](https://discourse.julialang.org/t/wglmakie-animations/52084/3 "2020-12-19T13:39:08Z")

</div>

Hi Simon,

thank you very much for your reply. I apologize for the missing MWE: I though that the answer might have been that this feature was not covered by WGLMakie.

Here is the MWE :

```julia
using WGLMakie # OK with GLMakie

function test(n,nh)
    scene = Scene()
    x = [(i-1)*2π/(n-1) for i in 1:n]
    y = sin.(x)
    xn = Node(y)

    scatter!(scene,lift(x -> x , xn),markersize=5,color = :red)
    lines!(scene,lift(x -> x , xn),color = :blue)

    record(scene, "output.mp4", 1:nh) do j
        y .= sin.(x .+ 2π*j/nh) 
        xn[] = y 
    end
end

test(100,100)

```

> **Pkg Status**
>
> ```julia
> (MovieMakie.jl) pkg> status
> Status `~/Projects/Spring.jl/MovieMakie.jl/Project.toml`
> [537997a7] AbstractPlotting v0.14.2
> [497a8b3b] DoubleFloats v1.1.15
> [e9467ef8] GLMakie v0.1.20
> [be4d8f0f] Quadmath v0.5.4
> [276b4fcb] WGLMakie v0.2.10
> 
> ```

> **versionfino()**
>
> ```julia
> julia> versioninfo()
> Julia Version 1.5.3
> Commit 788b2c77c1 (2020-11-09 13:37 UTC)
> Platform Info:
> OS: Linux (x86_64-pc-linux-gnu)
> CPU: Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
> WORD_SIZE: 64
> LIBM: libopenlibm
> LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
> Environment:
> JULIA_EDITOR = "/snap/code/52/usr/share/code/code"
> JULIA_NUM_THREADS =
> 
> ```

BTW, is there a simple way to skip the movie generation and only enjoy the animation ?

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [December 19, 2020, 2:53pm UTC](https://discourse.julialang.org/t/wglmakie-animations/52084/4 "2020-12-19T14:53:00Z")

</div>

Yes, just replace record with this:

```julia
display(scene)
foreach(1:nh) do j
        y .= sin.(x .+ 2π*j/nh) 
        xn[] = y
       yield()
end
```

---

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [December 19, 2020, 3:02pm UTC](https://discourse.julialang.org/t/wglmakie-animations/52084/5 "2020-12-19T15:02:40Z")

</div>

Ach, `yield()` of course.  
Thank you very much again !

When you mention the _latest version_, does this mean that my MWE should work with it ? I think that I use the latest release and I obtain an error…

---

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [December 19, 2020, 4:55pm UTC](https://discourse.julialang.org/t/wglmakie-animations/52084/6 "2020-12-19T16:55:00Z")

</div>

The “live” display is OK with, `display`,`yield` and `WGLMakie`.  
Thank you again !
