I’ve been more in the mood for snippets with effects rather than even a small project.
Here are some simple stars in the sky for a background.
Here is a still but they do twinkle if you run this.
http://pic.twitter.com/Frrcy1Yk
-- Twinkle
function setup()
st = {}
ns = 100 -- number of stars
for i = 1,ns do
if math.random(2) == 1 then g = .25 else g = -.25 end
l = 5 + (math.random(39)/4)
st[i] = {g=g,l=l,x=math.random(WIDTH),y=math.random(HEIGHT)}
end
end
function draw()
rect(0,0,1,1)
background(20, 46, 181, 255)
strokeWidth(3)
lineCapMode(SQUARE)
stroke(255, 255, 255, 255)
fill(255, 255, 255, 255)
for i = 1,ns do
if st[i].l <= 5 and math.random(2) == 1 then st[i].g = .25
elseif st[i].l >= 15 and math.random(2) == 1 then st[i].g = -.25 end
st[i].l = st[i].l + st[i].g
ll = (15 - st[i].l)/2
line(st[i].x-st[i].l,st[i].y,st[i].x+st[i].l,st[i].y)
line(st[i].x,st[i].y-st[i].l,st[i].x,st[i].y+st[i].l)
line(st[i].x-ll,st[i].y-ll,st[i].x+ll,st[i].y+ll)
line(st[i].x+ll,st[i].y-ll,st[i].x-ll,st[i].y+ll)
ellipse(st[i].x,st[i].y,6,6)
end
end