Class AnimationShape2DFactory

All Implemented Interfaces:
Cloneable

public final class AnimationShape2DFactory extends AbstrAnimShape2DFactory<AnimationShape2D>
Factory for creating animation shapes. In addition to controlling the stacking order (z-order) and visibility, this factory can configure an animation shape by adding animation paths to it. Each path provides part of a shape's outline. A winding rule is used to determine which paths represent an interior or exterior boundary for the shape. The Z-order and visibility will be ignored by animation layers. When an animation shape is used as part of an animation layer, its visibility should be set to false, which is the default for this factory.

This factory provides a method AbstrAnimShape2DFactory.set(String,int,Object) that will accept instances of Shape, PathIterator, String, and AnimationPath2D as its third argument. If a string is provided, the string must be the name of an instance of AnimationPath2D associated with the factory's animation.

The parameters this factory supports are shown in the following table (the documentation for object.type describes which "object" parameters are used for a given type): For example, with the scrunner command, one can use the following ECMAScript code to create a shape:


   scripting.importClass("org.bzdev.anim2d.Animation2D");
   scripting.importClass("org.bzdev.geom.Paths2D");
   Animation a2d = new Animation2D(scripting);
   ...
   a2d.createFactories("org.bzdev.anim2d", {
        shapef: "AnimationShape2DFactory"
   };
   var circle1 =
      Paths2D.createArc(0.0, 0.0, 100.0, 0.0, Math.toRadians(360));
   circle1.closePath();
   var circle2 = Paths2D.reverse
     (Paths2D.createArc(0.0, 0.0, 75.0, 0.0, Math.toRadians(360)));
   circle2.closePath();
   shapef.createObject("annulus", [
     {visible: true, zorder: 0},
     {fillColor.css: "paleyellow"},
     {drawColor.css: "black"},
     {stroke.width: 5.0},
     {windingRule: "WIND_NON_ZERO"},
     {withIndex: [
           {shape: circle1},
           {shape: circle2}
        ]}
   ]);
 
In this example, paths are created directly and those paths are used to define the outline for a shape.
See Also:
  • Constructor Details

    • AnimationShape2DFactory

      public AnimationShape2DFactory(Animation2D a2d)
      Constructor.
      Parameters:
      a2d - the animation
    • AnimationShape2DFactory

      public AnimationShape2DFactory()
      Constructor for service provider. This constructor should not be used directly. It is necessary because of the introduction of modules in Java 9, and is used by a service provider that allows factories to be listed, possibly with documentation regarding their parameters. It jst calls the default constructor with a null argument.
  • Method Details