Makie.jl icon indicating copy to clipboard operation
Makie.jl copied to clipboard

updating mesh in WGLMakie doesn't work as expected.

Open lazarusA opened this issue 3 years ago • 0 comments

There two issues with the following:

  • the first one is that the initial plot corresponds to the last slider index, it should be the first one?
  • the second one is that update the mesh doesn't work as expected. There are some artefacts.
using WGLMakie, JSServe, Observables
using GeometryBasics
using JSServe: Slider
using Random, Colors
function do_viz(t)
    spheret = @lift(normal_mesh(Tesselation(Sphere(Point3f(0), 1.0f0), $t)))
    wireframe(spheret; color = :white)
    mesh!(spheret; color = @lift($t*rand(RGBf)/32), transparency=true)
    return current_figure()
end

WGLMakie.activate!()
page = Page(offline=true, exportable=true)
app = JSServe.App() do session::Session
    index_slider1 = Slider(8:8:32, style="width: 350px;")
    slider1 = DOM.div("tess: ", index_slider1, index_slider1.value)
    fig  = do_viz(index_slider1.value)
    rpage = JSServe.record_states(session, DOM.div(DOM.div(slider1), fig))
    return rpage
end
open("app_tsphere.html", "w") do io
    println(io, """
    <body>
      <div id="container"></div>
        """)
      show(io, MIME"text/html"(), page)
      show(io, MIME"text/html"(), app)
      println(io, """
    </body>
    </html>
    """)
end
Screenshot 2022-08-07 at 11 37 04 Screenshot 2022-08-07 at 11 32 06

lazarusA avatar Aug 07 '22 09:08 lazarusA