Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Animated String Art
#1
Not sure if I had posted this before... If I have, let me know, and I will delete it... lol

This is a converted QB64 demo created by BPlus... 

If you are as old or older than I am then this will be a "flash back"... If you are young, then stare continuously at the rotating pattern, then transfer all your savings to the following account number... Moo Ha Ha Ha Ha....

Variable "t" on line #41 will determine the number of "points" to be drawn. The program will start with one point and increment by one until "t" is reached. Then it starts over again using a different colour... ESC to quit.

Code:
' Open a window and enable double buffering.
set window "String Art Animated", 600, 600, false
set redraw off

'   Converted from a QB64 program by BPlus

randomize clock()

visible xmax = 600
visible ymax = 600
visible a1, a2, cx, cy, r, s, n, pi, t
visible red, blue, green

r = ymax / 2
cx = xmax / 2
cy = ymax / 2
n = 250
s = 360 / n

red = 175
green = 255
blue = 255

pi = 3.141592654

t = 1

do
    set color 0, 0, 0
    cls
    'set color red, green, blue
    draw ellipse cx - 1, cy, r, r
    for i = 1 to n
        a1 = s * i
        a2 = s * i * t
        set color red, green , blue
        draw line cx + sin(d2r(a1)) * r, cy + cos(d2r(a1)) * r, cx + sin(d2r(a2)) * r, cy + cos(d2r(a2)) * r
    next
   
    t = t + 0.0125
    if t >= 20
        t = 1
        red = 32 + rnd(33, 255)
        green = 32 + rnd(33, 255)
        blue = 32 + rnd(33, 255)
    endif

    redraw
    fwait 60   
until keydown(KEY_ESCAPE, true)

'   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function d2r(angle)
    return angle * (pi / 180)
endfunc
'   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Logic is the beginning of wisdom.
Reply


Messages In This Thread
Animated String Art - by johnno56 - 07-11-2024, 08:36 PM
RE: Animated String Art - by 1micha.elok - 07-11-2024, 11:53 PM
RE: Animated String Art - by johnno56 - 07-12-2024, 01:00 PM
RE: Animated String Art - by 1micha.elok - 07-13-2024, 02:24 PM
RE: Animated String Art - by johnno56 - 07-13-2024, 07:16 PM

Forum Jump:


Users browsing this thread: 8 Guest(s)