How can i create circle with soft edges like this one??I believe that I should use Moaishader
Moderators: seebs, franciscotufro
How can i create circle with soft edges like this one??How can I access (and control) the attributes every pixel in the shapes that are drawn using MOAIDraw
- texture = MOAIImageTexture.new ()
- texture:init ( 124, 124 )
- for i = 1,122 do texture:setRGBA ( i, 0, 1, 1, 0, .5 ) texture:setRGBA ( i, 123, 1, 1, 0, 1 ) end
- for i = 1,122 do texture:setRGBA ( 0, i, 1, 1, 0, .5 ) texture:setRGBA ( 123, i, 1, 1, 0, 1 ) end
-
- for i = 1,122 do
- for j = 0,122 do
- texture:setRGBA ( i, j, 1, 1, 0, math.sin(i) )
- end
- end
- gfxQuad = MOAIGfxQuad2D.new ()
- gfxQuad:setTexture ( texture )
- gfxQuad:setRect ( -64, -64, 64, 64 )
- gfxQuad:setUVRect ( 0, 0, 1, 1 )
-
- prop = MOAIProp2D.new ()
- prop:setBlendMode(1)
- prop:setDeck ( gfxQuad )
- layer:insertProp ( prop )
-
- prop:moveRot ( 360, 5 )
-
- -- create a new object
- function new ( pParams )
- local result = {}
- result.init = function ( self, pParams )
- -- initialize object and return self
- return self
- end
- result.getAlpha = function ( self, pX, pY )
- local result
- -- set result using a calculation based on pX and pY
- -- the object state, such as bounding box or radius may factor into the calculation
- return result
- end
- -- return object
- return result:init ( pParams )
- end
Users browsing this forum: JoseGutierrez and 0 guests