add method

Animation add(
  1. Object obj,
  2. String effectName, [
  3. dynamic startValue,
  4. dynamic endValue,
  5. bool? cosmetic,
])

Add an object (GraphObject or Diagram) and effect name, with specified start and end values, to this Animation.

@param {GraphObject|Diagram} obj GraphObject or Diagram to animate. @param {string} effectName Animation effect name, such as "scale" to change GraphObject.scale. By default the supported properties are, for GraphObjects:

  • "position"
  • "location" (on Parts)
  • "scale"
  • "opacity"
  • "angle"
  • "desiredSize"
  • "width"
  • "height"
  • "background"
  • "fill" (on Shapes)
  • "strokeWidth" (on Shapes)
  • "strokeDashOffset" (on Shapes)
  • "stroke" (on Shapes, TextBlocks)

For Diagrams:

  • "position"
  • "scale"
  • "opacity"

More properties can be supported by defining new effects with AnimationManager.defineAnimationEffect. @param {} startValue The starting value for the animated property. Often this is the current value of the property. @param {} endValue The ending value for the animated property. Even if the animation is just cosmetic, this must be a valid value for the property. For instance, for GraphObject#scale, you cannot animate to 0, as this is an invalid scale value. Instead you would animate to a very small (but still valid) value, such as 0.001. @param {boolean=} cosmetic Determines if the animation should revert the property value to the start value at the end of animation. Default false. This is commonly used when animating opacity or scale of "disappearing" nodes during collapse. Even though the node may appear to go to scale 0.001, the programmer usually wants the scale to reflect its prior value, once hidden. @return {Animation} this Animation

Implementation

_i3.Animation add(
  _i2.Object obj,
  _i2.String effectName, [
  _i2.dynamic startValue,
  _i2.dynamic endValue,
  _i2.bool? cosmetic,
]) =>
    _i4.callMethod(
      this,
      'add',
      [
        obj,
        effectName,
        startValue,
        endValue,
        cosmetic ?? _i5.undefined,
      ],
    );