多義運動

HSPで多義運動のスクリプト
ちらつきが少し気になります。

//定数
#define pi 3.14159265
#define w_height 100
#define step 0.1
#define n_step int(pi*2/step)
#define n_cycle 10
#define w_width (n_step * n_cycle)

screen 0,w_width, w_height,0,100,100,w_width, w_height
screen 2,w_width, w_height,2,100,100,w_width, w_height
screen 3,w_width, w_height,2,100,100,w_width, w_height

cls 4

redraw 0

for i, 0, w_height
	theta = 0.0
	for j, 0, w_width
		//一つ目のsinusoidal grating 
		gsel 2
		col = (sin(theta) + 1) * (255.0/2)
		color col, col, col
	 	pset j,i
	 	
	 	//カウンターフェイズしたsinusoidal grating
	 	gsel 3
	 	col = (sin(theta + pi) + 1) * (255.0/2)
	 	color col, col, col
	 	pset j, i
	 	theta = theta + step
	next
next

gsel 0, 1
redraw 1

while 
	gsel 0, 1
	gcopy 2, 0, 0, w_width, w_height
	wait 20
	
	gsel 0, 1
	gcopy 3, 0, 0, w_width, w_height
	wait 20
wend