Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
node garden
#1
Code:
import "Keycodes.lib"
import "Speed.lib"

visible:
maxDist = 100
nodes?[maxDist]
w = 600
h = 600

hidden:

set window 0, 0, w, h

set redraw off

for i = 0 to maxDist-1
   nodes[i].x = rnd(h)
   nodes[i].y = rnd(w)
   nodes[i].vx = rnd(2)
   nodes[i].vy = rnd(2)
   nodes[i].r = rnd(256)
   nodes[i].g = rnd(256)
   nodes[i].b = rnd(256)
next

do
   set color 0, 0, 0
   cls
   for x = 0 to maxDist -1
       nodes[x].x = nodes[x].x + nodes[x].vx
       nodes[x].y = nodes[x].y + nodes[x].vy
       if nodes[x].x > w then
           nodes[x].x = 0
       elseif nodes[x].x < 0 then
           nodes[x].x = w
       endif
     
      if nodes[x].y > h then
           nodes[x].y = 0
       elseif nodes[x].y < 0 then
           nodes[x].y = h
       endif
       set color nodes[x].r, nodes[x].g, nodes[x].b
       draw ellipse nodes[x].x, nodes[x].y, 5, 5, true
   next

   for i = 0 to maxDist - 1
       for j = i + 1 to maxDist -1
           dx = nodes[j].x - nodes[i].x
           dy = nodes[j].y - nodes[i].y
           dist# = sqr(float(dx*dx)+float(dy*dy))
           if (int(dist) < maxDist) then
               set color nodes[i].r, nodes[i].g, nodes[i].b
               draw line nodes[i].x, nodes[i].y, nodes[j].x, nodes[j].y
           endif
       next
   next
   redraw
   _SPD_HoldFrame 30
until keydown(VK_ESC, true)

just for fun.
Reply
#2
COOL.....

 You may have just invented a new art form.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)