O'Reilly logo

ActionScript Graphing Cookbook by Peter Backx, Dominic Gélineau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Animating the transitions

In the previous recipe, we allowed the user to navigate through but we didn't animate the transitions, so it looks unprofessional and clunky. Animations also help the users grasp what is happening. This recipe is going to show how to animate a relational network.

Getting ready

Open the files downloaded from the Packt Publishing website for Chapter 8 | Recipe 5 to follow along.

How to do it...

The following are the steps required to animate a relational network:

  1. In NodeVisual.as, remove the function addLink.
  2. Still in NodeVisual, add the function _updateLine:
    private function _updateLine():void {
      _link.graphics.clear();
      _link.graphics.lineStyle(3, _color, 0.8);
      _link.graphics.lineTo( -x, -y);
    }
  3. Add the animateIn function:
    public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required