Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Atomic Heart
#1
Atomic Heart

Day before, I transferred my program to qb64
originally created in C#

Visualization helps to understand
how is desired unusual color formed
depending on the parameters Red Green Blue

Code: (Select All)
e = 50: d = -e: p = .001 ' atomicheart.bas
w = 400: h = 630: Screen _NewImage(w, h, 32)

d = d + e: For x = 90 To 256: For y = d To d + e
    PSet (x - 90, y), _RGB32(x, 0, 0):
Next: _Delay p: Next

d = d + e: For x = 90 To 256: For y = d To d + e
    PSet (x - 90, y), _RGB32(0, x, 0):
Next: _Delay p: Next

d = d + e: For x = 90 To 256: For y = d To d + e
    PSet (x - 90, y), _RGB32(0, 0, x):
Next: _Delay p: Next

'//////////////

d = d + e: For x = 255 To 90 Step -1: For y = d To d + e
    PSet (x - 90, y), _RGB32(0, x, x):
Next: _Delay p: Next

d = d + e: For x = 255 To 90 Step -1: For y = d To d + e
    PSet (x - 90, y), _RGB32(x, 0, x):
Next: _Delay p: Next

d = d + e: For x = 255 To 90 Step -1: For y = d To d + e
    PSet (x - 90, y), _RGB32(x, x, 0):
Next: _Delay p: Next


'//////////////


d = d + e: For y = d + e To d Step -1: For x = 40 To 206
    PSet (x - 40, y), _RGB32(205 - x, x, 0):
Next: _Delay p * 2: Next

d = d + e: For y = d + e To d Step -1: For x = 40 To 206
    PSet (x - 40, y), _RGB32(x, 205 - x, 0):
Next: _Delay p * 3: Next

d = d + e: For y = d + e To d Step -1: For x = 40 To 206
    PSet (x - 40, y), _RGB32(205 - x, 0, x):
Next: _Delay p * 5: Next



d = d + e: For y = d To d + e: For x = 205 To 40 Step -1
    PSet (x - 40, y), _RGB32(0, x, 205 - x)
Next: _Delay p * 7: Next

d = d + e: For y = d To d + e: For x = 205 To 40 Step -1
    PSet (x - 40, y), _RGB32(x, 0, 205 - x)
Next: _Delay p * 5: Next

d = d + e: For y = d To d + e: For x = 205 To 40 Step -1
    PSet (x - 40, y), _RGB32(0, 205 - x, x)
Next: _Delay p * 8: Next


e = 206: d = -e
d = d + e: For x = 30 To 256: For y = 50 To 256
    PSet (136 + x, d + y - 50), _RGB32(x, 0, y)
Next: _Delay p * 5: Next

d = d + e: For x = 255 To 30 Step -1: For y = 50 To 256
    PSet (136 + x, d + y - 50), _RGB32(0, x, y)
Next: _Delay p * 3: Next

d = d + e: For y = 255 To 50 Step -1: For x = 255 To 30 Step -1
    PSet (136 + x, d + y - 50), _RGB32(x, y, 0)
Next: _Delay p * 2: Next


Plus, I urge to include name
in first lines of program or in title

[Image: colorcs.gif] 57 kB
Write name of program in 1st line to copy & paste & save filename.bas
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic

Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself
Reply
#2
Inspiring, I love color!
Code: (Select All)
_Title "Atomic Heart Beat" 'b+ 2023-02-26 inspired by Danilin's Title and coloring
Const xmax = 400, ymax = 400
Screen _NewImage(xmax, ymax, 32)
CX = xmax / 2: CY = ymax / 2 - 25
While _KeyDown(27) = 0
    r1 = Rnd * 255: g1 = Rnd * 255: b1 = Rnd * 255
    r2 = Rnd * 255: g2 = Rnd * 255: b2 = Rnd * 255
    For magnify = 0 To 10 Step .0005
        For a = -_Pi To _Pi Step _Pi(10 / 360)
            x = CX + magnify * xCard(a)
            y = CY - magnify * yCard(a)
            If a <> -_Pi Then
                Line (x, y)-(lastx, lasty), midInk~&(r1, g1, b1, r2, g2, b2, magnify / 10)
            End If
            lastx = x: lasty = y
        Next
    Next
    _Display
    _Limit 4
Wend

Function midInk~& (r1%, g1%, b1%, r2%, g2%, b2%, fr##)
    midInk~& = _RGB32(r1% + (r2% - r1%) * fr##, g1% + (g2% - g1%) * fr##, b1% + (b2% - b1%) * fr##)
End Function

'Reference and thanks to:
' http://mathworld.wolfram.com/HeartCurve.html
' find the 6th heart curve equations #7, 8
Function xCard (t)
    xCard = 16 * Sin(t) ^ 3
End Function

Function yCard (t)
    yCard = 13 * Cos(t) - 5 * Cos(2 * t) - 2 * Cos(3 * t) - Cos(4 * t)
End Function
b = b + ...
Reply
#3
I think Bill did something similar with colorcycles or something
Reply




Users browsing this thread: 1 Guest(s)