Post by tsh73 on Nov 25, 2020 19:48:00 GMT
Thick line with border
which overprints making look like real layers (kind of 3d)
I dunno.
Really inspired by this, I guess.
justbasiccom.proboards.com/thread/314/celtic-knot-challenge
I had an idea - I got something working
Now go on and use it for something
which overprints making look like real layers (kind of 3d)
I dunno.
Really inspired by this, I guess.
justbasiccom.proboards.com/thread/314/celtic-knot-challenge
I had an idea - I got something working
Now go on and use it for something
'Want to get: thick line with colored border follows the mouse
'(by drawing rotated line with colored points)
nomainwin
open "Draw with a mouse" for graphics_nsb_nf as #gr
#gr "down; home; posxy cx cy"
#gr "trapclose [quit]"
#gr "when mouseMove [move]"
#gr "size 3"
x0=cx:y0=cy
timer 1, [tick]
d = 15
'#gr
wait
[tick]
'move x0 y0 into x y direction
dx=x-x0
dy=y-y0
a = atan2(dx,dy)
r=sqr(dx^2+dy^2)
if r<2 then wait
''else
x0=x0+dx/r'/2 'divide for smoother things (but slower)
y0=y0+dy/r'/2
#gr "north; turn ";a'+90
#gr "color black"
#gr "place ";x0;" ";y0
#gr "go ";d
#gr "color green"
#gr "posxy xx yy"
#gr "set ";xx;" ";yy
#gr "color black"
#gr "go ";-2*d
#gr "color green"
#gr "posxy xx yy"
#gr "set ";xx;" ";yy
wait
[move]
x=MouseX
y=MouseY
' #gr "color red"
' #gr "set ";x;" ";y
WAIT
[quit]
close #gr
end
function atan2(x,y) 'returns 0..360 degrees
if abs(x)<0.001 then atan2 = 90+(y<0)*180 : exit function
pi = 3.1415925
tan = y/x
atn = atn(tan)
select case
case x>0 and y>0
atan2 = atn/pi*180
case x<=0
atn = atn + pi
atan2 = atn/pi*180
case else
atn = atn + 2*pi
atan2 = atn/pi*180
end select
end function