Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Questions and Answers >> Attribute that changes depending on hour of day
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1480629044

Message started by Fernando Rodriguez on Dec 1st, 2016, 4:50pm

Title: Attribute that changes depending on hour of day
Post by Fernando Rodriguez on Dec 1st, 2016, 4:50pm

Hi,

Is it possible to have an attribute, such as color, that changes depending on the time?

Title: Re: Attribute that changes depending on hour of day
Post by Mark Bernstein on Dec 1st, 2016, 6:42pm

Sure. For example:

    Rule: if( date("today").minute > 30 ) {$Color = "red"} else {$Color="blue"}

should turn notes red for part of the hour and blue for the rest.

[admin edit:  added $ references to 'Color']

Title: Re: Attribute that changes depending on hour of day
Post by Mark Anderson on Dec 2nd, 2016, 6:44am

If you want a gradual change over the hour, you can do thing like this rule:

$Color="green";
$Color.saturation=(date("today").minute/60)*100


At minute 00, the note on the map is coloured a desaturated grey and slowly colours up to full green at minute 59. Or, try

$Color="green";
$Color.hue=(date("today").minute/60)*100


The the color goes from red at 00 through vasrious shades of orange and yellow to green at 59. Or try:

$Color="green";
$Color.brightness=(date("today").minute/60)*100


At 00 the note will be almost black at at 59 will be neon-bright green. Or you could combine something.

The designators 'now' and 'today' do the same thing: passing in your current system date/time. For any Date-type attribute you can access the .minute (minutes) or .hour (hours). Any Color-type attributes can read or set .brightness .hue and .saturation.

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.