Hello guys,
I’m currently trying to set rect transparency with a shader. ( ripple effect in this case )
Codea built in shader sample represents pretty much my same situation :
-- Use this function to perform your initial setup
displayMode(STANDARD)
function setup()
parameter.number("Freq",0,5,2)
parameter.integer("Texture",1,5,2)
allTextures = {
CAMERA,
"Cargo Bot:Codea Icon",
"Small World:Store Extra Large",
"Small World:Windmill",
"Tyrian Remastered:Boss D",
}
cameraSource(CAMERA_FRONT)
m = mesh()
m.texture = allTextures[Texture]
m.shader = shader("Effects:Ripple")
rIdx = m:addRect(0, 0, 0, 0)
m:setRectColor(rIdx, 255,0,0,10)
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
-- This sets the line thickness
strokeWidth(5)
-- Here we set up the rect texture and size
m.texture = allTextures[Texture]
local cw,ch = spriteSize(allTextures[Texture])
m:setRect(rIdx, WIDTH/2, HEIGHT/2, cw, ch)
-- Configure out custom uniforms for the ripple shader
m.shader.time = ElapsedTime
m.shader.freq = Freq
-- Draw the mesh
m:draw()
end
is there a way to play with rectangles’ alpha value?
setRectColor doesn’t seem to affect alpha at all or maybe I’m just not using it the right way.
Any idea?
thank you
Alex