Smoother colors in sinic*.py

This commit is contained in:
lep 2019-01-01 15:28:11 +01:00
parent 09d90b6479
commit c668de99e5
2 changed files with 11 additions and 10 deletions

View File

@ -33,11 +33,11 @@ x, y = np.meshgrid(
img = np.zeros( [Ny, Nx, 3] )
Sa = Slider(-3, 3, 0.01, -0.5)
Sb = Slider(-3, 3, 0.01, 0.5)
Sc = Slider(0, 1, 0.005, 0)
Sa = Slider(-3, 3, 0.01, np.random.uniform(-1, 1))
Sb = Slider(-3, 3, 0.01, np.random.uniform(-1, 1))
Sc = Slider(0, 1, 0.005, np.random.uniform(-1, 1))
Scolor = Slider(0, 1, 0.01/iterations, 0)
Scolor = Slider(0, 1, 0.001/iterations, 0)
step = 0
while True:
@ -49,7 +49,7 @@ while True:
Sb.pos += c*0.001
Sc.pos += a*0.001
curve = 1*(np.sin(c) + np.sin(np.sin(a*x) + np.cos(b*y)) - np.cos(np.sin(b*x*y) + np.cos(b*x)) <= 0.1)
curve = (np.clip(np.sin(c) + np.sin(np.sin(a*x) + np.cos(b*y)) - np.cos(np.sin(b*x*y) + np.cos(b*x)), 0, 1))
cr, cg, cb = colorsys.hsv_to_rgb(Scolor.step(), 1, 1)

View File

@ -33,11 +33,12 @@ x, y = np.meshgrid(
img = np.zeros( [Ny, Nx, 3] )
Sa = Slider(-3, 3, 0.01, -0.5)
Sb = Slider(-3, 3, 0.01, 0.5)
Sc = Slider(0, 1, 0.005, 0)
Sa = Slider(-3, 3, 0.01, np.random.uniform(-1, 1))
Sb = Slider(-3, 3, 0.01, np.random.uniform(-1, 1))
Sc = Slider(0, 1, 0.005, np.random.uniform(-1, 1))
Scolor = Slider(0, 1, 0.001/iterations, 0)
Scolor = Slider(0, 1, 0.01/iterations, 0)
step = 0
while True:
@ -49,7 +50,7 @@ while True:
Sb.pos += c*0.001
Sc.pos += a*0.001
curve = 1*(c+np.sin(a*x*x-b*y*y)-np.sin(a*x+b*y)-np.cos(a*b*x*y) <= 0.1)
curve = np.clip(c+np.sin(a*x*x-b*y*y)-np.sin(a*x+b*y)-np.cos(a*b*x*y), 0, 1)
cr, cg, cb = colorsys.hsv_to_rgb(Scolor.step(), 1, 1)