xx = math.random(3) - 2 yy = math.random(3) - 2 translate(xx,yy)
An effect to recreate jiggly old CRTs
I put it at the start of the draw loop in sprite invaders and it looks great (actually it looks bad but that's the point)
This simple effect can also be used when you want to show a game shaking (explosion, big Dino footsteps, etc). Just increase the numbers.
For something I may be working on I used this on a flame. Instead of translate, I used it to flicker the tip of the flame. 11 minus 6.
LOL - that's fun.
Reminds me of this http://www.cultofmac.com/78961/turn-terminal-app-into-a-flickering-vintage-crt-with-cathode/
The flame is here http://ipad41001.posterous.com/biochar-app-v000-in-codea
Was thinking about neon lights
function draw()
isCRT = false
--isCRT = true
background(40, 40, 50)
if isCRT then
font("Inconsolata")
fill(0, 255, 27, 255)
else --neon sign
font("MarkerFelt-Thin")
fill(255, 0, 232, 255)
end
tw = 800 --text width
th = 200 --text height
fs = 200 --fontsize
i = image(tw/10,th/10)
fontSize(fs/10)
setContext(i)
text("Codea",tw/20,th/20)
setContext()
if isCRT then
fill(0, 255, 27, 255)
xx = math.random(3) - 2
yy = math.random(3) - 2
translate(xx,yy)
else --neon
fill(255, 0, 232, 127)
end
if math.random() > .01 then
sprite(i,WIDTH/2,HEIGHT/2,tw,th)
end
fontSize(fs)
text("Codea",WIDTH/2,HEIGHT/2)
end
I was fiddling around with a title screen for Orb-Bits, and found it amazing just how much pure random fud could be pushed out to generate "static." In its simplest implementation:
for i = 1, 1000 do
rect(math.random(WIDTH), math.random(HEIGHT), 1, 1)
end
I wouldn't use it as background for anything more active than a title screen. I'm just amazed that it works even when nothing else is going on.
A slightly different pattern of static
function setup()
end
function draw()
pr = image(WIDTH,1)
for x = 1, WIDTH do
dot = math.random(125)
pr:set(x,1,dot,dot,dot,255)
end
for y = 1, HEIGHT do
pps = math.random(WIDTH)
--sprite(pr,(WIDTH/2)-ps[y],y)
--sprite(pr,WIDTH+(WIDTH/2)-ps[y],y)
sprite(pr,(WIDTH/2)-pps,y)
sprite(pr,WIDTH+(WIDTH/2)-pps,y)
end
end
It looks like you're new here. If you want to get involved, click one of these buttons!