This class will pulsate four lines away from your touch.
--# Main
-- Pulsation
displayMode(FULLSCREEN)
supportedOrientations(CurrentOrientation)
function setup()
end
function draw()
background(40, 40, 50)
if tched then p:draw() end
end
function touched(t)
if t.state==BEGAN and not tched then
p = Pulse(t.x,t.y)
tched = true
end
end
--# Pulse
Pulse = class()
function Pulse:init(x,y)
self.alpha = 255
rightx1,rightx2 = x+10,x+50
leftx1,leftx2 = x-10,x-50
bottomy1,bottomy2 = y-10,y-50
topy1,topy2 = y+10,y+50
self.x = x
self.y = y
self.red = math.random(255)
self.green = math.random(255)
end
function Pulse:draw()
rightx1,rightx2 = rightx1+10,rightx2+10
leftx1,leftx2 = leftx1-10,leftx2-10
bottomy1,bottomy2 = bottomy1-10,bottomy2-10
topy1,topy2 = topy1+10,topy2+10
self.alpha = self.alpha - 15
strokeWidth(5)
stroke(self.red,self.green,self.alpha)
line(rightx1,self.y,rightx2,self.y)
line(leftx1,self.y,leftx2,self.y)
line(self.x,topy1,self.x,topy2)
line(self.x,bottomy1,self.x,bottomy2)
if self.alpha<5 then tched=false end
end