I made this little think.
http://www.youtube.com/watch?v=HjYAQf_qxQA
You can paint with real transparency.
function setup()
parameter("red",0,255,244)
parameter("green",0,255,100)
parameter("blue",0,255,100)
parameter("alpha",0,255,200)
parameter("thickness",1,80,25)
iparameter("cap",0,2,0)
iparameter("feather",0,1,0)
myDrawing=image(WIDTH,HEIGHT)
myBack=image(WIDTH,HEIGHT)
end
function draw()
local v,t,angle
if(CurrentTouch.state==BEGAN or CurrentTouch.state==MOVING) then
if(feather==1) then
v = vec2(CurrentTouch.x,CurrentTouch.y)
-vec2(CurrentTouch.prevX,CurrentTouch.prevY)
angle = v:angleBetween(vec2(1,-1))
t = thickness * math.abs(math.cos(angle))+5
else
t = thickness
end
strokeWidth(t)
lineCapMode(cap)
stroke(red, green, blue, 255)
setContext(myDrawing)
tint(255, 255, 255, 255)
line(CurrentTouch.prevX,CurrentTouch.prevY,CurrentTouch.x,CurrentTouch.y)
else
setContext(myBack)
tint(255, 255, 255, alpha)
sprite(myDrawing,WIDTH/2,HEIGHT/2)
setContext(myDrawing)
background(0,0,0,0)
end
setContext()
background(0, 0, 0, 255)
tint(255, 255, 255, 255)
sprite(myBack,WIDTH/2,HEIGHT/2)
tint(255, 255, 255, alpha)
sprite(myDrawing,WIDTH/2,HEIGHT/2)
end
BTW I’m a musician, did you notice :-)) ?