Created a text effect that you sometimes see in movies (I don’t know if it has a name)
--# Main
function setup()
num = {"1","2","3","4","5","6","7","8","9"}
start = false
parameter.text("string", function(n) txt=n end)
parameter.action("Start_Effect",function() e=Effect(txt) end)
end
function draw()
background(0)
if start then
e:draw()
end
end
--# Effect
Effect = class()
function Effect:init(txt)
start=true
self.t = string.upper(txt)
self.letters = {}
self.timer = 0
for i=1,string.len(self.t) do
self.letters[i] = string.sub(self.t,i,i)
end
end
function Effect:draw()
fill(42, 78, 31, 255)
font("AmericanTypewriter-Bold")
fontSize(20)
self.timer = self.timer + 1
for a,b in pairs(self.letters) do
if self.timer>15*a then
text(b,a*18+200,HEIGHT/2)
elseif b~=" " then
text(num[math.random(#num)],a*18+200,HEIGHT/2)
end
end
end