Makie.jl
Makie.jl copied to clipboard
updating mesh in WGLMakie doesn't work as expected.
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