Hi there, fellow Corona users,
I have a problem that is really bothering me for the last 2 days.
I’m currently working on a “finger paint” application, the user will be coloring the screen using his/her finger. Checking on the forum I found a fingerPaint library, that really did the job…
… except that if you want to implement an eraser tool, you have no way of removing just parts of the stroke, since fingerPaint lib creates a single line at every touch cycle (began-moved-ended).
So I tought to create my line using circles in a fashion similar to this:
local circleGrp = display.newGroup() local function onCanvasTouch(event) if event.phase == "began" then local circle = display.newCircle(circleGrp, event.x, event.y, 15) elseif event.phase == "moved" then local circle = display.newCircle(circleGrp, event.x, event.y, 15) elseif event.phase == "ended" then local circle = display.newCircle(circleGrp, event.x, event.y, 15) end end
This works and creates a line of single dots that can later be easily removed one by one when a touch intersect them…
The problem is that when you drag around your finger a bit faster, the circles created in the moved phase are drawn really far apart from one another. I am assuming that this is because the touch listener doesn’t get called really often for perfomances reasons… So i’m trying to fill the gaps but as of now I really didn’t found any way that works!
Can someone show me the way?
OR if you are familiar with fingerPaint library, could you give me some hints on how to implement an eraser tool?
Thank you very much! 