Create radial gradient

Hi my name is Erick and first of all, i’m new at Corona, and have been reading the forum and the community just seems great in support and collaboration, so in advanced tnx to everyone 'cause even without touching the SDK i have learned a lot just with that.

My first question here is about drawing a radial gradient, i have found a linear gradient script and i wanted to know if there is something similar for a radial…

Tnx again for your time and sharing.

Erick [import]uid: 13637 topic_id: 5825 reply_id: 305825[/import]

Here is some pseudo code …

[code]
for i = 0, height, 2 do

local percent = i/height;
local amt = (1.0 - percent );
myRed = amt * rr + percent * r
myGreen = amt * gg + percent * g
myBlue = amt * bb + percent * b
local newRect = display.newCircle(display.contentWidth/2,display.contentHeight/2,radius);
newRect:setFillColor(myRed,myGreen,myBlue,255);
radius = radius - 2;
end

[/code] [import]uid: 24 topic_id: 5825 reply_id: 20190[/import]

It’s amazing your support to the community,
Thank you Carlos implementing the code right now! [import]uid: 13637 topic_id: 5825 reply_id: 20391[/import]

This is what the code above reproduced.

Carlos [import]uid: 24 topic_id: 5825 reply_id: 20442[/import]

Wooo, it’s like the sun…

No…
Wait…

Its…

CORONA! [import]uid: 9371 topic_id: 5825 reply_id: 20447[/import]

Sweeeeet!! Really nice Carlos, in a couple of weeks i will be showing my app to be submitted with some beautiful gradients!!.. :smiley: [import]uid: 13637 topic_id: 5825 reply_id: 20508[/import]

I’m wondering about the linear gradient script you said you already had. I haven’t been able to track down an example of that. Can you post that? [import]uid: 3671 topic_id: 5825 reply_id: 29243[/import]

Hi @acrowne you can find it here:

http://developer.anscamobile.com/code/bitwise-operators-lua

give a good check to the Code Exchange area, is treasure after treasure finding there :smiley:

http://developer.anscamobile.com/code/

Hope it helps…

eD [import]uid: 13637 topic_id: 5825 reply_id: 29331[/import]

That’s great. Thanks @edlvox!

Adrian [import]uid: 3671 topic_id: 5825 reply_id: 29353[/import]