usingMakieusingColors"""
This example is courtesy of @neuralian through the Julia Discourse.
https://discourse.julialang.org/t/makie-interaction-slider-with-animation/25179/10
"""x₀=-5.0#gateState = falsexRange=10.0# deflectionp₀(x)=x/2.0# plotnPts=100.0x=(x₀.+collect((-nPts/2.):(nPts/2.))/nPts*xRange)scene=lines(x,p₀(x),linewidth=4,color=:darkcyan,leg=false)axis=scene[Axis]axis[:names][:axisnames]=("x","y")D=Node(x₀)HC_handle=scatter!(lift(x->[x],D),[2.0],marker=:circle,markersize=1.,color=:red)[end]s1=slider(LinRange(-10.0,0.0,101),raw=true,camera=campixel!,start=-10.0)kx=s1[end][:value]scatter!(scene,lift(x->[x;x],kx),lift(x->[0.5;p₀(x)],kx),marker=:hexagon,color=RGBA(.5,0.,.5,.5),markersize=.35,strokewidth=.01,strokecolor=:black)S=Scene(resolution=(800,600))hbox(scene,s1;parent=S)@asyncbeginwhile!isopen(S)# wait for screen to be opensleep(0.01)endwhileisopen(S)p=p₀((10.0+kx[])/10.)gateState=rand(1)[]<pHC_handle[:color]=gateState?:gold1::dodgerblue1push!(D,-3.+rand(1)[]/5.)sleep(0.001)endendRecordEvents(S,"output");