Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Attribute that changes depending on hour of day (Read 567 times)
Fernando Rodriguez
Full Member
*
Offline



Posts: 7
San Jose, CA
Attribute that changes depending on hour of day
Dec 01st, 2016, 4:50pm
 
Hi,

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


-------------
@frr149
WWW   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Attribute that changes depending on hour of day
Reply #1 - 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']
Back to top
 
« Last Edit: Dec 2nd, 2016, 6:26am by Mark Anderson »  
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Attribute that changes depending on hour of day
Reply #2 - 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.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print