ProtoFlux:Stopwatch: Difference between revisions

From Resonite Wiki
No edit summary
m Yosh moved page ProtoFlux:Stop Watch to ProtoFlux:Stopwatch: Stopwatch is one word and not camelcased inside frooxengine. it shouldn't be treated as two separate words here
 
(4 intermediate revisions by 3 users not shown)
Line 18: Line 18:
}}
}}


A simple Stopwatch node.
The '''Stopwatch''' node keeps track of time when running. Akin to a [https://en.wikipedia.org/wiki/Stopwatch real stopwatch], it allows one to start time, stop time, and reset time.
 
{{stub}}


== Inputs ==
== Inputs ==


=== Start ([[Impulses|Call]]) ===  
=== Start ([[Impulses|Call]]) ===
Starts the stopwatch, putting it in the running state.


Call this to Start the Stopwatch => puts the Stopwatch into a Running state.
=== Stop ([[Impulses|Call]]) ===
Does nothing if the Stopwatch is already in the Running state.
Stops the stopwatch, putting it in the stopped state.
If Stopwatch Reset was not called, Time Output will continue from the value it was when it was last in a Stopped state.


=== Stop ([[Impulses|Call]]) ===  
=== Reset ([[Impulses|Call]]) ===
 
Resets the stopwatch time. Does not affect the state of the stopwatch.
Call this to Stop the Stopwatch => puts the Stopwatch into a Stopped state. (default)
Does nothing if the Stopwatch is already in the Stopped state.
If Stopwatch Reset was not called, Time Output will be the value it was when it was last in a Stopped state. (default 0)
 
=== Reset ([[Impulses|Call]]) ===
 
Call this to Reset the Stopwatch => puts the Stopwatch into a Stopped state. (default)
Calling Reset sets the Time Output to zero (0).


== Outputs ==
== Outputs ==


=== OnStarted ([[Impulses|Continuation]]) ===
=== OnStarted ([[Impulses|Continuation]]) ===
 
Sends an impulse when <code>Start</code> is impulsed. Is not affected by the state of the stopwatch.
Sends an impulse after a Start ([[Impulses|Call]]) has been impulsed.


=== OnStopped ([[Impulses|Continuation]]) ===
=== OnStopped ([[Impulses|Continuation]]) ===
 
Sends an impulse when <code>Stop</code> is impulsed. Is not affected by the state of the stopwatch.
Sends an impulse after a Stop ([[Impulses|Call]]) has been impulsed.


=== OnReset ([[Impulses|Continuation]]) ===
=== OnReset ([[Impulses|Continuation]]) ===
 
Sends an impulse when <code>Reset</code> is impulsed. Is not affected by the state of the stopwatch.
Sends an impulse after a Reset ([[Impulses|Call]]) has been impulsed.


=== Time ([[Type:Float|Float]]) ===
=== Time ([[Type:Float|Float]]) ===
The time in seconds stored by the stopwatch. This value increments when in the running state and freezes when in the stopped state. If <code>Reset</code> is pulsed, this output is set to <code>0</code>, but continues the same behavior of the state the watch is in.


Returns the amount of time since the stopwatch has been started, as a ([[Type:Float|Float]]) representing seconds before the decimal place and fractions of a second after the decimal place. If a ([[Type:TimeSpan|TimeSpan]]) is desired instead of a ([[Type:Float|Float]]), use the ([[ProtoFlux:TimeSpanFromSeconds|TimeSpanFromSeconds]]) node to convert for the appropriate resolution.
Sometimes, it may be desirable to obtain a [[Type:TimeSpan|TimeSpan]] type from this value. To do so, use a [[ProtoFlux:TimeSpan From Seconds|TimeSpan From Seconds]] node.


=== IsRunning ([[Type:Bool|Bool]]) ===
=== IsRunning ([[Type:Bool|Bool]]) ===
 
<code>True</code> if the stopwatch is in a running state, <code>False</code> otherwise.
Is true if the Stopwatch is in a Running state and false if the Stopwatch is in a Stopped state.


== Examples ==
== Examples ==
{{stub}}


[[Category:ProtoFlux:Time]]
[[Category:ProtoFlux:Time]]

Latest revision as of 19:39, 4 July 2024

Stopwatch
Start
OnStart
Stop
OnStop
Reset
OnReset
Time
IsRunning
Actions

The Stopwatch node keeps track of time when running. Akin to a real stopwatch, it allows one to start time, stop time, and reset time.

Inputs

Start (Call)

Starts the stopwatch, putting it in the running state.

Stop (Call)

Stops the stopwatch, putting it in the stopped state.

Reset (Call)

Resets the stopwatch time. Does not affect the state of the stopwatch.

Outputs

OnStarted (Continuation)

Sends an impulse when Start is impulsed. Is not affected by the state of the stopwatch.

OnStopped (Continuation)

Sends an impulse when Stop is impulsed. Is not affected by the state of the stopwatch.

OnReset (Continuation)

Sends an impulse when Reset is impulsed. Is not affected by the state of the stopwatch.

Time (Float)

The time in seconds stored by the stopwatch. This value increments when in the running state and freezes when in the stopped state. If Reset is pulsed, this output is set to 0, but continues the same behavior of the state the watch is in.

Sometimes, it may be desirable to obtain a TimeSpan type from this value. To do so, use a TimeSpan From Seconds node.

IsRunning (Bool)

True if the stopwatch is in a running state, False otherwise.

Examples