Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: serdar on August 21, 2010, 02:03:33 PM

Title: Change Brightness With MakeHSL
Post by: serdar on August 21, 2010, 02:03:33 PM
I want to make a photo machine flash effect.
I thought, I can change the Lightness of background with the MakeHSL method to simulate the photo machine flash.

I'm using this code block...

Code: [Select]
var bck = Scene.GetNode("background");

on "LeftClick"
{
//returns 0
var H = GetHValue(bck.AlphaColor);
//returns 0
var S = GetSValue(bck.AlphaColor);
//returns 0
var L = GetLValue(bck.AlphaColor);
 
// on paint.net saturation default is 100 and
// if i set Lightness to 30 it changes the brightness
// i wanted to simulate it with this code
bck.AlphaColor = MakeHSL(H, 100, 30);   
// but this makes the screen completely dark...
 
Game.ScreenshotEx(Game.SaveDirectory + "\test.bmp");

bck.AlphaColor = MakeHSL(H, 100, L);   
}

this changes the brightness but not similar to flash effect
Why this AlphaColor property needs for loop?
Code: [Select]
for(var i=5; i<25; i=i+2)
{
bck.AlphaColor = MakeHSL(H, S, i*20);   
Sleep(2);
}



Can you guide me to simulate photo machine flash? Probably I'm on the wrong way...
Title: Re: Change Brightness With MakeHSL
Post by: metamorphium on August 21, 2010, 03:09:29 PM
why are you changing only transparency channel?
Title: Re: Change Brightness With MakeHSL
Post by: serdar on August 21, 2010, 03:25:46 PM
i do not know what other things to do...

on paint.net
if i just change the lightness
it is ok for me

i tried to do the same on wintermute.
Title: Re: Change Brightness With MakeHSL
Post by: metamorphium on August 21, 2010, 06:06:33 PM
I don't think you can do it this way. What I'd do is probably less elegant, but I'd use white bitmap and quickly animate it's transparency from 0 to 255 to achieve the same effect

here you'd use something like this:

for (var a=0;a<255;a=a+15)
{
   back.AlphaColor = MakeRGBA(255,255,255,a);
   Sleep(30);
}

Or you can use Scene.FadeOut(60,255,255,255,255);