Click or drag to resize
AB4D logo

RenderingTimer Class

Computer speed independent timer that is using CompositionTarget.Rendering event and reports progress from 0 to 1 in the Duration period.
Inheritance Hierarchy
SystemObject
  Ab3d.CommonRenderingTimer

Namespace: Ab3d.Common
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.1.8864.1045
Syntax
C#
public class RenderingTimer : ICompositionRenderingSubscriber

The RenderingTimer type exposes the following members.

Constructors
 NameDescription
Public methodRenderingTimer Constructor
Top
Properties
 NameDescription
Public propertyDuration Duration in which the Progress goes from 0.0 to 1.0
Public propertyProgress The current Progress value (during animation its goes from 0.0 to 1.0)
Public propertyRepeatForever If true than the timer is not stopped when Progress = 1.0, but the Progress is set to 0.0 (Default value is false).
Top
Methods
 NameDescription
Protected methodOnTick OnTick occurs on each rendering event and triggers the Tick event
Public methodStart Starts the RenderingTimer animation
Public methodStop Stops the RenderingTimer animation
Top
Events
 NameDescription
Public eventCompleted Event that is raised when the animation is completed.
Public eventTick Event that is raised every time the Progress value is changed (on every frame - rendering pass)
Top
Remarks

The RenderingTimer can be used to create manual animations that depend only on the animation Duration and are not affected by the actual computer speed (frames per second).

The RenderingTimer changes the value of Progress property from 0 to 1. At the start of animation the Progress value is 0, at the time of Duration the value of Progress is 1. If RepeatForever value is true, the animation repeats again with setting Progress back to 0. On each Progress change (on each frame) the Tick event is raised. When the animation is finished the Completed event is raised (if RepeatForever is not true).

To start the animation the Start method must be called. The animation can be stopped by calling Stop method.

See Also