AnimationTrigger class

An AnimationTrigger describes how to automatically animate a property on a GraphObject when it changes value. The target property name is a string, and all name matching is case-sensitive.

Triggers will be shared by all copies of the template's GraphObjects. You can include AnimationTriggers in your templates just like Bindings are included:

$(go.Panel, "Vertical",
  // This trigger uses the default value of AnimationTrigger.startCondition:
  // If a transaction is ongoing and Panel.position is changed, this trigger will animate
  // all changes to Panel.position at the end of the next transaction, in one bundled Animation.
  // If no transaction is ongoing, then it will animate this value immediately.
  new go.AnimationTrigger("position"),
  {
    // ... Panel properties
  },
  $(go.Shape,
    // Animate all changes to Shape.opacity immediately
    new go.AnimationTrigger("opacity", null, go.AnimationTrigger.Immediate),
    {
     // ... Shape properties
    }
  )

When the #startCondition is AnimationTrigger.Default, GoJS will attempt to AnimationTrigger.Bundled or AnimationTrigger.Immediate based on the state of the transaction. If no transaction is ongoing, this trigger will treat the default as using AnimationTrigger.Immediate. Otherwise it will work as AnimationTrigger.Bundled.

When the #startCondition is AnimationTrigger.Bundled, the AnimationManager will use the default animation to prepare a single Animation that begins when the current transaction has ended. This animation may be canceled if a new transaction is started.

When the #startCondition is AnimationTrigger.Immediate, a new animation will be created for every instance of the property changed, and started immediately, and run until completion. This may be useful for cosmetic changes, such as animating the opacity or color of an object on mouseEnter or mouseLeave.

You can only specify properties that exist on the GraphObject, and are also registered with AnimationManager.defineAnimationEffect. By default these properties are:

  • "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 animation properties are given in the Introduction Page on Animations.

Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

AnimationTrigger(String propertyName, [IInline0? animationSettings, EnumValue? startCondition])
factory

Properties

animationSettings ↔ dynamic

Available on AnimationTrigger, provided by the AnimationTrigger$Typings extension

These settings are only used if the #startCondition is AnimationTrigger.Immediate. Creating a new AnimationTrigger with animationSettings in the constructor automatically sets #startCondition to AnimationTrigger.Immediate
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
propertyName String

Available on AnimationTrigger, provided by the AnimationTrigger$Typings extension

Gets or sets the name of the property to animate on the target GraphObject. The default value is set during constructor initialization.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startCondition EnumValue

Available on AnimationTrigger, provided by the AnimationTrigger$Typings extension

Gets or sets the starting condition for this trigger.
getter/setter pair

Methods

copy() AnimationTrigger

Available on AnimationTrigger, provided by the AnimationTrigger$Typings extension

Create a copy of this AnimationTrigger, with the same property values. @expose @return {AnimationTrigger}
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

bundled EnumValue
Used as a value for #startCondition. The AnimationManager will use the default animation to prepare a single Animation that begins when the current transaction has ended. This animation may be canceled if a new transaction is started.
getter/setter pair
default$ EnumValue
Used as a value for #startCondition. GoJS will attempt to AnimationTrigger.Bundled or AnimationTrigger.Immediate based on the state of the transaction. If no transaction is ongoing, this trigger will be treated as using AnimationTrigger.Immediate, otherwise it will work as AnimationTrigger.Bundled.
getter/setter pair
immediate EnumValue
Used as a value for #startCondition. A new animation will be created for every instance of the property changed, and started immediately, and run until completion. This may be useful for cosmetic changes, such as animating the opacity or color of an object on mouseEnter or mouseLeave. However, using AnimationTrigger.Bundled may be more efficient, as it will create fewer
getter/setter pair