Sorry, but I recorded a MiniFB window with OBS and converted the result to gif with ffmpeg
Here is the code:
#] add https://github.com/mfiano/CoherentNoise.jl
using Luxor
using Colors
using MiniFB
using ColorSchemes
using CoherentNoise
using ThreadPools
struct Window
c::ReentrantLock
w::Int
h::Int
d::Drawing
buffer::Matrix{ARGB32}
function Window(w,h)
c=ReentrantLock()
b=zeros(ARGB32, w, h)
d=Drawing(b)
origin()
new(c,w,h,d,b)
end
end
function window_update_task(win::Window, showFPS=true)
w=win.w
h=win.h
updateCount=0
startTime=floor(Int, time())
fps="0"
sb=zeros(ARGB32, 105, 55)
window = mfb_open_ex("MiniFB", w, h, MiniFB.WF_RESIZABLE)
state=MiniFB.STATE_OK
set_drawing = true
while state == MiniFB.STATE_OK
lock(win.c)
if set_drawing
currentdrawing(win.d)
set_drawing = false
end
if showFPS
elapsedTime=floor(Int,time())-startTime
if elapsedTime > 1
fps=string(round(Int,updateCount/elapsedTime))
startTime=floor(Int,time())
updateCount=0
end
sb.=win.buffer[1:105, 1:55]
@layer begin
(dx,dy) = Point(0.0, 0.0) - getworldposition(Point(0.0, 0.0);centered=false)
setcolor(1.0, 0, 0, 0.5)
fontsize(50)
text(fps, Point(5+dx, 5+dy), halign=:left, valign = :top)
end
end
state=mfb_update(window,win.buffer)
if showFPS
win.buffer[1:105, 1:55].=sb
end
unlock(win.c)
sleep(1.0/120.0)
updateCount+=1
end
println("\nWindow closed\n")
end
const WIDTH = 400
const HEIGHT = 400
win = Window(WIDTH, HEIGHT)
let window=win
global t_window_update_task
function t_window_update_task()
window_update_task(window)
end
end
spawnbg(t_window_update_task)
rng(sampler::AbstractSampler) = sampler.random_state.rng
function CoherentNoise.gen_image(buffer,
sampler::S;
w::Integer=1024,
h::Integer=1024,
xbounds::NTuple{2,Float64}=(-1.0, 1.0),
ybounds::NTuple{2,Float64}=(-1.0, 1.0),
colorscheme=nothing,
) where {N,S<:AbstractSampler{N}}
x1, x2 = xbounds
y1, y2 = ybounds
xd = (x2 - x1) / w
yd = (y2 - y1) / h
zw = rand(rng(sampler), Float64, N - 2) * 1000
Threads.@threads for x in 1:w
cx = x * xd + x1
for y in 1:h
cy = y * yd + y1
value = sample(sampler, cx, cy, zw...) * 0.5 + 0.5
buffer[x, y] = colorscheme !== nothing ? colorscheme[value] : value
end
end
end
sampler1 = cache(OpenSimplex{2}(seed=1))
#sampler1 = cache(Constant(seed=1))
ub=10.0
lb=-10.0
rad=1.0
#while true
for sc in 0.0:0.01:2pi
#sampler2 = CoherentNoise.Modifiers.rotate(CoherentNoise.Modifiers.scale(OpenSimplex{2}(seed=2),0.8);z=rad)
sampler2 = CoherentNoise.Modifiers.rotate(OpenSimplex{2}(seed=2);z=3.0+1.5*sin(sc))
sampler3 = CoherentNoise.Modifiers.rotate(OpenSimplex{2}(seed=3);z=3.0-1.5*cos(sc))
#println(rad)
sampler = warp(sampler1;x=sampler2,y=sampler3)
lock(win.c)
gen_image(win.buffer,sampler,w=WIDTH,h=HEIGHT,colorscheme=ColorSchemes.terrain,xbounds=(ub,lb),ybounds=(ub,lb))
unlock(win.c)
#sleep(0.001)
end
#end