' Version 2020-12-15
'_FULLSCREEN , _SMOOTH
ObjectSize = 6
DIM SHARED Level
(GridSize.x
, GridSize.y
) AS ShadeVector
LINE (12, 12)-(18 * (UBOUND(ShadeData
) + 1) - 1 + 6 + 12, 38 + 12), _RGB32(0, 0, 255, 255), BF
LINE (12, 12)-(18 * (UBOUND(ShadeData
) + 1) - 1 + 6 + 6, 38 + 6), _RGB32(255, 0, 255, 255), BF
LINE (12, 12)-(18 * (UBOUND(ShadeData
) + 1) - 1 + 6, 38), _RGB32(0, 0, 0, 255), BF
x = PixelCloud(k).position.x
y = PixelCloud(k).position.y
s = PixelCloud(k).size
CALL clinebf
(x
- s
, y
- s
, x
+ s
, y
+ s
, _RGBA(PixelCloud
(k
).TheShade.shadered
, PixelCloud
(k
).TheShade.shadegreen
, PixelCloud
(k
).TheShade.shadeblue
, PixelCloud
(k
).TheShade.shadealpha
))
s = ObjectSize
x = (i - 1) * s
y = (j - 1) * s
IF (Level
(i
, j
).shadered
> 5) OR (Level
(i
, j
).shadegreen
> 5) OR (Level
(i
, j
).shadeblue
> 5) THEN CALL slinebf
(x
- s
/ 2, y
- s
/ 2, x
+ s
/ 2 - 1, y
+ s
/ 2 - 1, _RGBA(Level
(i
, j
).shadered
, Level
(i
, j
).shadegreen
, Level
(i
, j
).shadeblue
, Level
(i
, j
).shadealpha
))
IF ActiveShade.shadered
< 5 AND ActiveShade.shadegreen
< 5 AND ActiveShade.shadeblue
< 5 THEN LINE (ObjectSize
* INT(_MOUSEX / ObjectSize
) - ObjectSize
/ 2 - 1, ObjectSize
* INT(_MOUSEY / ObjectSize
) - ObjectSize
/ 2 - 1)-(ObjectSize
* INT(_MOUSEX / ObjectSize
) + ObjectSize
/ 2 - 1 + 1, ObjectSize
* INT(_MOUSEY / ObjectSize
) + ObjectSize
/ 2 - 1 + 1), _RGBA(255, 255, 255, 255), B
LINE (ObjectSize
* INT(_MOUSEX / ObjectSize
) - ObjectSize
/ 2, ObjectSize
* INT(_MOUSEY / ObjectSize
) - ObjectSize
/ 2)-(ObjectSize
* INT(_MOUSEX / ObjectSize
) + ObjectSize
/ 2 - 1, ObjectSize
* INT(_MOUSEY / ObjectSize
) + ObjectSize
/ 2 - 1), _RGBA(ActiveShade.shadered
, ActiveShade.shadegreen
, ActiveShade.shadeblue
, ActiveShade.shadealpha
), BF
LINE (18 * k
+ 1, 18)-(18 * (k
+ 1) - 1, 32), _RGB32(ShadeData
(k
).TheShade.shadered
, ShadeData
(k
).TheShade.shadegreen
, ShadeData
(k
).TheShade.shadeblue
, ShadeData
(k
).TheShade.shadealpha
), BF
LINE (18 * k
+ 1, 18)-(18 * (k
+ 1) - 1, 32), _RGB32(255, 255, 255, 255), B
ShadeData(1).TheName = "Red"
ShadeData(1).TheShade.shadered = 255
ShadeData(1).TheShade.shadegreen = 0
ShadeData(1).TheShade.shadeblue = 0
ShadeData(1).TheShade.shadealpha = 255
ShadeData(2).TheName = "Blue"
ShadeData(2).TheShade.shadered = 0
ShadeData(2).TheShade.shadegreen = 0
ShadeData(2).TheShade.shadeblue = 255
ShadeData(2).TheShade.shadealpha = 255
ShadeData(3).TheName = "Green"
ShadeData(3).TheShade.shadered = 0
ShadeData(3).TheShade.shadegreen = 255
ShadeData(3).TheShade.shadeblue = 0
ShadeData(3).TheShade.shadealpha = 255
ShadeData(4).TheName = "White"
ShadeData(4).TheShade.shadered = 255
ShadeData(4).TheShade.shadegreen = 255
ShadeData(4).TheShade.shadeblue = 255
ShadeData(4).TheShade.shadealpha = 255
ShadeData(5).TheName = "Yellow"
ShadeData(5).TheShade.shadered = 255
ShadeData(5).TheShade.shadegreen = 255
ShadeData(5).TheShade.shadeblue = 0
ShadeData(5).TheShade.shadealpha = 255
ShadeData(6).TheName = "Aqua"
ShadeData(6).TheShade.shadered = 0
ShadeData(6).TheShade.shadegreen = 255
ShadeData(6).TheShade.shadeblue = 255
ShadeData(6).TheShade.shadealpha = 255
ShadeData(7).TheName = "Violet"
ShadeData(7).TheShade.shadered = 255
ShadeData(7).TheShade.shadegreen = 0
ShadeData(7).TheShade.shadeblue = 255
ShadeData(7).TheShade.shadealpha = 255
ShadeData(8).TheName = "Black"
ShadeData(8).TheShade.shadered = 0
ShadeData(8).TheShade.shadegreen = 0
ShadeData(8).TheShade.shadeblue = 0
ShadeData(8).TheShade.shadealpha = 255
PixelCloud(k).size = 3
PixelCloud(k).acceleration.x = 0
PixelCloud(k).acceleration.y = 0
PixelCloud(k).velocity.x = 0
PixelCloud(k).velocity.y = 0
PixelCloud
(k
).position.x
= (RND - .5) * _WIDTH * .8 PixelCloud
(k
).position.y
= (RND - .5) * _HEIGHT * .8 CALL SetPixelShade
(k
, 0, 0, 255, 150)
ActiveShade.shadered = 255
ActiveShade.shadegreen = 0
ActiveShade.shadeblue = 0
ActiveShade.shadealpha = 255
PixelCloud(i).TheShade.shadered = r
PixelCloud(i).TheShade.shadegreen = g
PixelCloud(i).TheShade.shadeblue = b
PixelCloud(i).TheShade.shadealpha = a
mb1 = 0
mb2 = 0
mb3 = 0
mb1 = -1
Level(i, j).shadered = ActiveShade.shadered
Level(i, j).shadegreen = ActiveShade.shadegreen
Level(i, j).shadeblue = ActiveShade.shadeblue
Level(i, j).shadealpha = ActiveShade.shadealpha
mb2 = -1
PixelCloud(k).TheShade.shadered = 255
PixelCloud(k).TheShade.shadegreen = 0
PixelCloud(k).TheShade.shadeblue = 0
PixelCloud(k).TheShade.shadered = 0
PixelCloud(k).TheShade.shadegreen = 0
PixelCloud(k).TheShade.shadeblue = 255
PixelCloud
(k
).position.x
= (RND - .5) * _WIDTH * .8 PixelCloud
(k
).position.y
= (RND - .5) * _HEIGHT * .8 Level(i, j).shadered = 0
Level(i, j).shadegreen = 0
Level(i, j).shadeblue = 0
Level(i, j).shadealpha = 0
'DO WHILE _MOUSEINPUT: LOOP
PRINT #1, i
, j
, Level
(i
, j
).shadered
, Level
(i
, j
).shadegreen
, Level
(i
, j
).shadeblue
, Level
(i
, j
).shadealpha
CALL CalculateInfluence
(k
)
dt = 1
damp = 0.8
brownian = .65
PixelCloud(i).velocity.x = damp * PixelCloud(i).velocity.x + dt * PixelCloud(i).acceleration.x
PixelCloud(i).velocity.y = damp * PixelCloud(i).velocity.y + dt * PixelCloud(i).acceleration.y
PixelCloud
(i
).position.x
= PixelCloud
(i
).position.x
+ dt
* PixelCloud
(i
).velocity.x
+ (RND - .5) * brownian
PixelCloud
(i
).position.y
= PixelCloud
(i
).position.y
+ dt
* PixelCloud
(i
).velocity.y
+ (RND - .5) * brownian
IF (PixelCloud
(i
).position.y
<= -_HEIGHT / 2 + 2 * PixelCloud
(i
).size
+ 1) THEN PixelCloud
(i
).position.y
= _HEIGHT / 2 - 2 * PixelCloud
(i
).size
x = PixelCloud(i).position.x
y = PixelCloud(i).position.y
dx = 2 * PixelCloud(i).size
dy = 2 * PixelCloud(i).size
WPoint(7) = cpoint(x - dx, y + dy)
WPoint(8) = cpoint(x, y + dy)
WPoint(9) = cpoint(x + dx, y + dy)
WPoint(4) = cpoint(x - dx, y)
WPoint(6) = cpoint(x + dx, y)
WPoint(1) = cpoint(x - dx, y - dy)
WPoint(2) = cpoint(x, y - dy)
WPoint(3) = cpoint(x + dx, y - dy)
cs = 0
x = 0
y = 0
' red
WShade(k) = 0
xr
= (WShade
(6) - WShade
(4) + (WShade
(9) + WShade
(3)) / SQR(2) - (WShade
(7) + WShade
(1)) / SQR(2)) yr
= (WShade
(8) - WShade
(2) + (WShade
(7) + WShade
(9)) / SQR(2) - (WShade
(1) + WShade
(3)) / SQR(2)) x = x + xr
y = y + yr
' blue
WShade(k) = 0
xb
= (WShade
(6) - WShade
(4) + (WShade
(9) + WShade
(3)) / SQR(2) - (WShade
(7) + WShade
(1)) / SQR(2)) yb
= (WShade
(8) - WShade
(2) + (WShade
(7) + WShade
(9)) / SQR(2) - (WShade
(1) + WShade
(3)) / SQR(2)) x = x + xb
y = y + yb
' green
cs = 1
WShade(k) = 0
xg
= -(WShade
(6) - WShade
(4) + (WShade
(9) + WShade
(3)) / SQR(2) - (WShade
(7) + WShade
(1)) / SQR(2)) yg
= (0 - WShade
(2) + (0 + 0) / SQR(2) - (WShade
(1) + WShade
(3)) / SQR(2)) x = x + xg
y = y + yg
' custom yellow
cs = 1
WShade(k) = 0
xc
= (WShade
(6) - 0 + (WShade
(9) + WShade
(3)) / SQR(2) - (0 + 0) / SQR(2)) yc = 0
x = x + xc
y = y + yc
' custom aqua
cs = 1
WShade(k) = 0
xc
= -(WShade
(6) - 0 + (WShade
(9) + WShade
(3)) / SQR(2) - (0 + 0) / SQR(2)) yc = 0
x = x + xc
y = y + yc
' custom white
cs = 1
WShade(k) = 0
xc
= -(WShade
(6) - WShade
(4) + (WShade
(9) + WShade
(3)) / SQR(2) - (WShade
(7) + WShade
(1)) / SQR(2)) yc
= -(0 - WShade
(2) + (0 + 0) / SQR(2) - (WShade
(1) + WShade
(3)) / SQR(2)) x = x + xc
y = y + yc
' custom violet
cs = 1
WShade(k) = 0
xc
= (WShade
(6) - WShade
(4) + (WShade
(9) + WShade
(3)) / SQR(2) - (WShade
(7) + WShade
(1)) / SQR(2)) yc
= (WShade
(8) - WShade
(2) + (WShade
(7) + WShade
(9)) / SQR(2) - (WShade
(1) + WShade
(3)) / SQR(2)) x = x + xc
y = y + yc
' Conductivity
IF ((xr
* xr
+ yr
* yr
) > (xb
* xb
+ yb
* yb
)) THEN PixelCloud(i).TheShade.shadered = PixelCloud(i).TheShade.shadered + 64
IF (PixelCloud
(i
).TheShade.shadered
>= 255) THEN PixelCloud
(i
).TheShade.shadered
= 255 PixelCloud(i).TheShade.shadeblue = PixelCloud(i).TheShade.shadeblue - 64
IF (PixelCloud
(i
).TheShade.shadeblue
<= 0) THEN PixelCloud
(i
).TheShade.shadeblue
= 0 IF ((xb
* xb
+ yb
* yb
) > (xr
* xr
+ yr
* yr
)) THEN PixelCloud(i).TheShade.shadered = PixelCloud(i).TheShade.shadered - 64
IF (PixelCloud
(i
).TheShade.shadered
<= 0) THEN PixelCloud
(i
).TheShade.shadered
= 0 PixelCloud(i).TheShade.shadeblue = PixelCloud(i).TheShade.shadeblue + 64
IF (PixelCloud
(i
).TheShade.shadeblue
>= 255) THEN PixelCloud
(i
).TheShade.shadeblue
= 255
' Gravity vs. levity
y = y - (PixelCloud(i).TheShade.shadered - PixelCloud(i).TheShade.shadeblue) / 255
' Normalize acceleration
PixelCloud(i).acceleration.x = 0
PixelCloud
(i
).acceleration.x
= -x
/ SQR(x
* x
+ y
* y
) PixelCloud(i).acceleration.y = 0
PixelCloud
(i
).acceleration.y
= -y
/ SQR(x
* x
+ y
* y
)
' Auto-cooling
PixelCloud(i).TheShade.shadered = PixelCloud(i).TheShade.shadered - 2
IF (PixelCloud
(i
).TheShade.shadered
<= 0) THEN PixelCloud
(i
).TheShade.shadered
= 0 PixelCloud(i).TheShade.shadeblue = PixelCloud(i).TheShade.shadeblue + 2
IF (PixelCloud
(i
).TheShade.shadeblue
>= 255) THEN PixelCloud
(i
).TheShade.shadeblue
= 255
cpoint = TheReturn
LINE (x1
, y1
)-(x2
, y2
), col
, BF
INPUT #1, i
, j
, r
, g
, b
, a
Level(i, j).shadered = r
Level(i, j).shadegreen = g
Level(i, j).shadeblue = b
Level(i, j).shadealpha = a