Code:
' Color Out of Space
' ------------------
include "s3d.n7"
#win32
constant FULLSCREEN = 1
set window "Color Out of Space", 480*screenw()/screenh(), 480, FULLSCREEN
set redraw off
img = CreateFuzzImage(16)
S3D_SetView(primary, rad(45), 0.1, 100)
particles = []
set color 0, 0, 32
cls
spina = 0
while not keydown(KEY_ESCAPE, true)
spina = (spina + 0.25)%360
spin = (spin + sin(rad(spina))*2)%360
for i = 1 to 3 particles[sizeof(particles)] = Particle(img)
i = 0
while i < sizeof(particles)
if particles[i].Update() i = i + 1
else free key particles, i
wend
set color 0, 0, 32, 8
cls
S3D_Clear()
S3D_Translate(0, 0, 12)
S3D_RotateX(-rad(20))
S3D_RotateZ(rad(spin))
set additive true
foreach p in particles p.Draw()
set additive false
redraw
fwait 60
wend
function Particle(img)
a = rnd()*2*PI
p = []
p.img = img
p.hw = width(img)/2; p.hh = height(img)/2
p.dst = [cos(a)*10 + rnd() - 0.5, sin(a)*10 + rnd() - 0.5, 0]
p.src = [rnd() - 0.5, rnd() - 0.5, 25 + rnd() - 0.5]
p.pos = dim(3); p.prj = dim(3)
p.r = rnd(64); p.g = rnd(64); p.b = rnd(64)
p.s = 32 + rnd(48)
p.p = 0
p.Update = function()
this.p = this.p + 0.006
if this.p > 1 return false
A = 3*this.p^2; B = 2*this.p^3; C = 3*this.p^2; D = 2*this.p^3
pos = this.pos; src = this.src; dst = this.dst
for i = 0 to 2 pos[i] = src[i] - src[i]*A + src[i]*B + dst[i]*C - dst[i]*D
return true
endfunc
p.Draw = function()
if S3D_ProjectVector(this.prj, this.pos)
a = 255 - this.p*255
set color this.r, this.g, this.b, a
s = this.s/this.prj[2]
draw image xform this.img, this.prj[0], this.prj[1], s, s, 0, this.hw, this.hh
endif
endfunc
return p
endfunc
function CreateFuzzImage(size)
img = createimage(size, size)
set image img
c = size/2
for y = 0 to size - 1 for x = 0 to size - 1
cc = 255 - 255*sqr((x - c)^2 + (y - c)^2)/(c - 1)
set color cc, cc, cc
set pixel x, y
next
set image primary
return img
endfuncJust some twirling particles.

