XML: Timer: Difference between revisions
No edit summary |
|||
| Line 14: | Line 14: | ||
Pseudocode: | Pseudocode: | ||
<Visible>(P:Absolute time,seconds) "seed" % "blink lapse" > !</Visible> | <Visible>(P:Absolute time,seconds) "seed" % "blink lapse" "seed" * > !</Visible> | ||
The seed parameter is the total length of the blinking cycle. For example, if you want something to blink once every | The seed parameter is the total length of the blinking cycle. For example, if you want something to blink once every | ||
| Line 21: | Line 21: | ||
For each seed, you can determine how long would be the duration of both the visible and invisible part. | For each seed, you can determine how long would be the duration of both the visible and invisible part. | ||
Then: | Then: | ||
(P:Absolute time,seconds) 1 % 0.5 > ! | (P:Absolute time,seconds) 1 % 0.5 1 * > ! | ||
this will make the visible and invisible parts of half a second each. | this will make the visible and invisible parts of half a second each. | ||
(P:Absolute time,seconds) 1 % 0.7 > ! | (P:Absolute time,seconds) 1 % 0.7 1 * > ! | ||
this will make the visible part 70% of the cycle (0.7 secs) and invisible parts of 30 % (0.3 secs). | this will make the visible part 70% of the cycle (0.7 secs) and invisible parts of 30 % (0.3 secs). | ||
(P:Absolute time,seconds) 0.5 % 0.25 > ! | (P:Absolute time,seconds) 0.5 % 0.25 1 * > ! | ||
this will make the visible and invisible parts a quarter of second each. | this will make the visible and invisible parts a quarter of second each. | ||
(P:Absolute time,seconds) 12 % 0.5 12 * > ! | |||
this will make the visible and invisible parts of 6 seconds each. | |||
(P:Absolute time,seconds) 12 % 0.7 12 * > ! | |||
this will make the visible part 70% of the cycle (8.4 secs) and invisible parts of 30 % (3.6 secs). | |||
You can invert the cycle by removing the "!" char. | You can invert the cycle by removing the "!" char. | ||
[[Category:Aircraft Design]] | [[Category:Aircraft Design]] | ||
[[Category:Panel and Gauge Design]] | [[Category:Panel and Gauge Design]] | ||
Latest revision as of 18:14, 28 February 2012
XML: Timer
With this universal code it's very simple to control not only the length of the cycle but the frequency of the blink itself:
Pseudocode:
<Visible>(P:Absolute time,seconds) "seed" % "blink lapse" "seed" * > !</Visible>
The seed parameter is the total length of the blinking cycle. For example, if you want something to blink once every second, you use 1, if you want it blink every half a second, use 0.5 , every two seconds, 2 ,etc.
For each seed, you can determine how long would be the duration of both the visible and invisible part. Then:
(P:Absolute time,seconds) 1 % 0.5 1 * > !
this will make the visible and invisible parts of half a second each.
(P:Absolute time,seconds) 1 % 0.7 1 * > !
this will make the visible part 70% of the cycle (0.7 secs) and invisible parts of 30 % (0.3 secs).
(P:Absolute time,seconds) 0.5 % 0.25 1 * > !
this will make the visible and invisible parts a quarter of second each.
(P:Absolute time,seconds) 12 % 0.5 12 * > !
this will make the visible and invisible parts of 6 seconds each.
(P:Absolute time,seconds) 12 % 0.7 12 * > !
this will make the visible part 70% of the cycle (8.4 secs) and invisible parts of 30 % (3.6 secs).
You can invert the cycle by removing the "!" char.