No title

Post Reply
Henko
Posts: 816
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

No title

Post by Henko »

Code: Select all

graphics ! graphics clear ! draw color 0,0,0 ! draw size 1
xo=screen_width()/2 ! yo=screen_height()/2
option angle degrees
ampl=40 ! leng=780 ! angl=0 ! freq=4 ! steps=30 ! xo=0 ! refresh off
for yo=20 to 800 step 3
  plot_sinus(xo,yo,angl,leng,ampl,freq,steps)
next yo
yo=0 ! angl=85
for xo=-20 to 800 step 3
  plot_sinus(xo,yo,angl,leng,ampl,freq,steps)
next xo
refresh
end

' plot a sinus wave with following caracreristics
' xo and yo : starting point on the screen
' angl : angle (degrees) with wich the wave is drawn
' leng : length of the wave in # pixels
' ampl : (semi) amplitude of sine wave (pixels)
' freq : frequency of wave (# full cycles within given length)
' steps: coarseness of the graph (drawing steps per full cycle)
'
def plot_sinus(xo,yo,angl,leng,ampl,freq,steps)
dlab=leng/freq/steps
ux=cos(angl) ! uy=sin(angl) ! vx=-uy ! vy=ux
draw to xo,yo
for r=1 to leng step dlab
  fac=ampl*sin(360*freq*r/leng)
  x=xo+r*ux+fac*vx ! y=yo+r*uy+fac*vy
  draw line to x,y
  next r
end def

[attachment=0]image.jpeg[/attachment]
Attachments
image.jpeg
image.jpeg (1.43 MiB) Viewed 1131 times

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: No title

Post by rbytes »

Very pretty! You could call it "Sine of the Times". :D
Attachments
image.png
image.png (5.38 MiB) Viewed 1124 times
The only thing that gets me down is gravity...

Post Reply