day/night cycle using canvas

Using canvas, how could i make it change transparency to give the impression of day/night?
Game Editor discussion board
http://game-editor.com/forum/
transp = transp - .001;
r = 0;
g = 0;
b = 0;
// now your actor is pitchblack.
Kalladdolf wrote:I'd even not use transparency, but rgb values.
skydereign wrote:Well if it isn't transparent, you won't be able to see behind it.
Kalladdolf wrote:skydereign wrote:Well if it isn't transparent, you won't be able to see behind it.
Hence I'd also trash the black box. :3
master0500 wrote:but cant i just set the min value at .3 if i don't want it ti become fully black?
master0500 wrote:How can i make it so it darkens, and stays like that for a while, then lightens and stays like that for a while as well as having a sun and moon arcing across the sky?
double ang = (int)abs(90-sun_angle)%360;
if(ang>180.0)
{
ang = 360.0-ang;
}
transp = 1.0-(ang/180.0)*0.7;