SurfaceAnimator offers a few methods for animating parts of a Surface widget:

  • animateToPosition animates some vertex to a new position
  • tracePath animates an overlay along the path from some vertex to some other vertex
  • traceEdge animates an overlay along one edge

Hierarchy (view full)

Methods

  • Animate the given vertex to the given [x,y] location.

    Parameters

    • el: string | Element | Node | Group
    • x: number
    • y: number
    • Optional animateOptions: {
          complete?: Function;
          duration?: number;
          start?: Function;
          step?: Function;
      }
      • Optional complete?: Function
      • Optional duration?: number
      • Optional start?: Function
      • Optional step?: Function

    Returns void

  • Bind an event listener. This method can be used with a type parameter by call sites; although it's not necessary it can be helpful to use this to ensure you've thought about what the payload to your event handler is going to be.

    Type Parameters

    • T = any

    Parameters

    • event: string

      Name of the event(s) to bind to.

    • listener: ((a, e?) => any)

      Function to bind to the given event(s)

        • (a, e?): any
        • Parameters

          • a: T
          • Optional e: any

          Returns any

    • Optional insertAtStart: boolean

      Whether or not to insert this listener at the head of the listener queue. Defaults to false.

    Returns EventGenerator

  • Fire the named event.

    Type Parameters

    • T

    Parameters

    • event: string

      Event to fire

    • Optional value: T

      Value to pass to event handlers

    • Optional originalEvent: Event

      Optional original event that caused this event to be fired.

    Returns any

  • Traces an overlay along an edge.

    Parameters

    • params: {
          complete?: Function;
          edge: string | Edge;
          options?: OverlayAnimationOptions;
          overlay: OverlaySpec;
          start?: Function;
      }

      Overlay tracing options

      • Optional complete?: Function
      • edge: string | Edge

        Edge, or edge id, to trace the overlay along

      • Optional options?: OverlayAnimationOptions
      • overlay: OverlaySpec

        Definition of the overlay to trace along the edge.

      • Optional start?: Function

    Returns void

  • Traces an overlay along a path.

    Parameters

    • params: {
          listener?: PathTransportListener;
          options?: OverlayAnimationOptions;
          overlay: OverlaySpec;
          path?: Path;
          paused?: boolean;
          source?: string | Vertex;
          target: string | Vertex;
      }

      Path tracing options

      • Optional listener?: PathTransportListener

        Optional listener for events.

      • Optional options?: OverlayAnimationOptions

        Options for the animation.

      • overlay: OverlaySpec

        Definition of the overlay to trace along the path

      • Optional path?: Path

        The path to trace. Provide this, or provide source and target

      • Optional paused?: boolean

        If true, the animation will start in a paused state.

      • Optional source?: string | Vertex

        Source vertex to trace Path from. Provide this and target, or path.

      • target: string | Vertex

        Target vertex to trace Path to. Provide this and source, or path.

    Returns PathTransport

  • Unbind the given event listener, or all listeners. If you call this method with no arguments then all event listeners are unbound.

    Parameters

    • Optional eventOrListener: string | Function

      Either an event name, or an event handler function

    • Optional listener: Function

      If eventOrListener is defined, this is the event handler to unbind.

    Returns EventGenerator