Class AnimationTrigger

GoDiagram®
v10.0.8
by Northwoods Software®

An AnimationTrigger describes how to automatically animate a property on a GraphObject.

Inheritance
AnimationTrigger
Namespace: Northwoods.Go
Assembly: Northwoods.GoDiagram.WinForms.dll
Syntax
public class AnimationTrigger

Constructors

AnimationTrigger(string, (int? Duration, Action<Animation> Finished, EasingFunction Easing)?, StartCondition?)

This constructor creates an AnimationTrigger. These are typically constructed within Part templates.

Declaration
public AnimationTrigger(string propertyName, (int? Duration, Action<Animation> Finished, EasingFunction Easing)? animationSettings = null, StartCondition? startCondition = null)
Parameters
Type Name Description
string propertyName

A string naming the target property to animate. This should not be the empty string.

(int? Duration, Action<Animation> Finished, EasingFunction Easing)? animationSettings

An optional tuple describing properties to set on animations created by this AnimationTrigger. See the AnimationSettings property for detail. If specified, this also sets the StartCondition to Immediate.

StartCondition? startCondition

An optional StartCondition to set the StartCondition property.

Properties

AnimationSettings

These settings are only used if the StartCondition is Immediate. Creating a new AnimationTrigger with animationSettings in the constructor automatically sets StartCondition to Immediate.

Declaration
public (int? Duration, Action<Animation> Finished, EasingFunction Easing)? AnimationSettings { get; set; }
Property Value
Type Description
(int? Duration, Action<Animation> Finished, EasingFunction Easing)?
Remarks

This gets or sets the settings for any Animations this trigger creates. Immediate triggers create a new Animation with each triggering, and apply these settings to that Animation.

This can be set to a tuple with a subset of possible Animation settings. The default value is null, which keeps default Animation settings.

Since a StartCondition of Bundled uses the default animation, you must set the properties of DefaultAnimation, and not this property, to modify the animation settings.

To set default settings for all created Animations, you can modify the settings on AnimationManager instead, such as Duration.

PropertyName

Gets or sets the name of the property to animate on the target GraphObject. The default value is set during constructor initialization.

Declaration
public string PropertyName { get; set; }
Property Value
Type Description
string
Remarks

You can only specify properties that exist on the GraphObject, and are also registered with DefineAnimationEffect(string, AnimationFunction). By default these properties are the same as the list of possible Animation effects:

  • "Position"
  • "Location" (on Parts)
  • "Scale"
  • "Opacity"
  • "Angle"
  • "DesiredSize"
  • "Width"
  • "Height"
  • "Background"
  • "Fill" (on Shapes)
  • "StrokeWidth" (on Shapes)
  • "StrokeDashOffset" (on Shapes)
  • "Stroke" (on Shapes, TextBlocks)

Examples of defining additional properties by adding animation effects are given in the Introduction Page on Animations.

StartCondition

Gets or sets the starting condition for this trigger.

Declaration
public StartCondition StartCondition { get; set; }
Property Value
Type Description
StartCondition
Remarks

AnimationTriggers can invoke an animation immediately, starting a new animation with each property of each GraphObject that has been modified, or they can (more efficiently) be bundled together into the default animation (DefaultAnimation) and begin only one animation, at the end of the next transaction.

It is useful for the StartCondition to be Immediate when changing GraphObject properties on MouseEnter or MouseLeave. It is useful for the StartCondition to be Bundled when changing several GraphObject properties together, such as when highlighting multiple parts, on selection changes, and during transactions, or when performance is a consideration.

These behaviors can be set with the values Immediate and Bundled, respectively. The default value, Default, attempts to infer which is best: It will start immediately if there is no ongoing transaction or if SkipsUndoManager is true, and otherwise bundle them.

Methods

Copy()

Create a copy of this AnimationTrigger, with the same property values.

Declaration
public AnimationTrigger Copy()
Returns
Type Description
AnimationTrigger