@巻く
--track0:めくり位置,0,100,90
--track1:半径,0,10000,100
--track2:細かさ,3,1000,10
--track3:らせん度dr,1,100,30
--check0:反対向き,0


Nw=obj.track2
Nh=1
W=obj.w/Nw
H=obj.h/Nh

x=obj.track0/100*Nw


R=obj.track1
dr=R*obj.track3/100/Nw
R2=R-dr*(x)
R3=R-dr*(Nw-x+1)

X1=x*W
X2=obj.w-X1

for i=0,Nw-1 do
for j=0,Nh-1 do

i0=i
i1=i+1
i2=i+1
i3=i

j0=j
j1=j
j2=j+1
j3=j+1

if(obj.check0) then

r0=R-dr*i
r1=R-dr*(i+1)
r2=r1
r3=r0

if((i+1)>x) then

sita0=(i*W-X1)/R
sita1=((i+1)*W-X1)/R
sita2=sita1
sita3=sita0

if(i<x) then

x0=(i)*W
x3=(i)*W

z0=0
z3=0

else

x0=X1+math.sin(sita0)*r0
x3=X1+math.sin(sita3)*r3

z0=math.cos(sita0)*r0-R2
z3=math.cos(sita3)*r3-R2

end

x1=X1+math.sin(sita1)*r1
x2=X1+math.sin(sita2)*r2

z1=math.cos(sita1)*r1-R2
z2=math.cos(sita2)*r2-R2

else

x0=i0*W
x1=i1*W
x2=i2*W
x3=i3*W

z0=0
z1=0
z2=0
z3=0

end


else

r0=R-(dr*(Nw-i))
r1=R-(dr*(Nw-(i+1)))
r2=r1
r3=r0

if((i)<x) then

sita0=-(i*W-X1)/R
sita1=-((i+1)*W-X1)/R
sita2=sita1
sita3=sita0

if((i+1)>x) then

x1=(i+1)*W
x2=(i+1)*W

z1=0
z2=0

else

x1=X1-math.sin(sita1)*r1
x2=X1-math.sin(sita2)*r2

z1=math.cos(sita1)*r1-R3
z2=math.cos(sita2)*r2-R3

end

x0=X1-math.sin(sita0)*r0
x3=X1-math.sin(sita3)*r3

z0=math.cos(sita0)*r0-R3
z3=math.cos(sita3)*r3-R3

else

x0=i0*W
x1=i1*W
x2=i2*W
x3=i3*W

z0=0
z1=0
z2=0
z3=0

end

end


obj.drawpoly(

x0-obj.w/2,(j0)*H-obj.h/2,z0,
x1-obj.w/2,(j1)*H-obj.h/2,z1,
x2-obj.w/2,(j2)*H-obj.h/2,z2,
x3-obj.w/2,(j3)*H-obj.h/2,z3,         
              
(i0)*W,(j0)*H,
(i1)*W,(j1)*H,
(i2)*W,(j2)*H,
(i3)*W,(j3)*H)

end
end