JuliaGizmos / Interact.jl

Interactive widgets to play with your Julia code
Other
520 stars 75 forks source link

Flickering graphics - is it me? #353

Open cormullion opened 4 years ago

cormullion commented 4 years ago

Great work on this! I'm trying to test Luxor.jl using Interact.jl (someone asked). It works fine, although there's a bit of flickering. This is quite possibly due to the way inefficient way Luxor does its display work (😄), but I'm wondering if there's a sneaky setting that minimizes it. It looks like the output cell is closing up and re-opening again for each "frame".

Code:

using Luxor, Interact

@manipulate throttle = 0.2 for r in 0:0.1:1, g in 0:0.1:1, b in 0:0.1:1, p in 10:100, q in 10:100
    d = Drawing(500, 500, :png) 
    background(r, g, b)
    origin()
    sethue("white")
    setline(2)
    hypotrochoid(200, p, q, :stroke)
    finish()
    d
end 
Screenshot 2020-02-27 at 12 27 35

I'm using Interact v0.10.3, Safari on macOS, with Julia 1.4.

twavv commented 4 years ago

How does Luxor handle drawing?

I think this has happened when using (e.g.) PyPlot because of the way that the plotting backend is implemented.

cormullion commented 4 years ago

I don't understand it too well myself but it's all in this section.