I’m trying to control a clip’s darkness and brightness by the current time of day. I don’t want to use a dozen or so if ( theTime == ) statements if I can really help it. This is what I have so far
function pictureClock()
{
var now = new Date ();
var dayPercent = ( now.getHours() > 12 ? now.getHours() - 12 : now.getHours()) / 24;
var hourPercent = now.getMinutes() / 60;
var minutePercent = now.getSeconds() / 60;
hourHand_mc._rotation = 360 * dayPercent + hourPercent * ( 360 / 24 );
minuteHand_mc._rotation = 360 * hourPercent;
secondHand_mc._rotation = 360 * minutePercent;
var brightness = new Color(skyline);
var brightnessTransform = new Object();
var brightnessAmount = 0 - ( 360 * minutePercent );
brightnessTransform.rb = brightnessAmount;
brightnessTransform.bb = brightnessAmount;
brightnessTransform.gb = brightnessAmount;
brightness.setTransform( brightnessTransform );
updateAfterEvent();
}
setInterval( pictureClock, 100 );
At the moment it fades to Night but does not fade back to Day, it suddenly jumps back to 0 at 12 noon. Any advice would be muchly appreciated
Thanks