Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function flair(parent, x, y, size)
- local self = display.newGroup()
- parent:insert(self)
- self.x, self.y = x, y
- for i=1,30 do
- local angle, radius, size, spin, bright = math.random() * 2 * math.pi, math.random(size * 2/3, size), math.random(size / 48, size / 16), math.random(180, 720), math.random(2) < 2 and "add" or "normal"
- local star = display.newRect(self, 0, 0, size, size) do
- star.x, star.y = math.cos(angle) * radius, math.sin(angle) * radius
- star.rotation = math.random(360)
- star.blendMode = bright
- transition.to(star, {time=1500, transition=easing.inQuad, delta=true; rotation=spin})
- end
- end
- transition.to(self, {time=1500, transition=easing.inQuad; alpha=0, y=self.y + self.height * 0.5 * self.yScale})
- local expansion = 1.5
- transition.to(self, {time=1500, onComplete=display.remove, transition=easing.outExpo; xScale=1.5, yScale=1.5})
- return self
- end
- Runtime:addEventListener('tap',
- function(event)
- flair(display.getCurrentStage(), event.x, event.y, display.contentWidth / 8 * event.numTaps)
- return true
- end
- )
- system.activate "multitouch"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement