java.lang.Object
- All Implemented Interfaces:
Cloneable
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:
In this example, paths are created directly and those paths are used to define the outline for 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} ]} ]);
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.obnaming.NamedObjectFactory
NamedObjectFactory.ConfigException, NamedObjectFactory.IndexedSetter, NamedObjectFactory.ParmNameIterator
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for service provider.Constructor. -
Method Summary
Methods inherited from class org.bzdev.anim2d.AbstrAnimShape2DFactory
clear, clear, initObject, remove, set, unset
Methods inherited from class org.bzdev.anim2d.AnimationObject2DFactory
addToTimelineRequest, getAnimation, getVisibility, getZorder, setAnimationObjectDefaults
Methods inherited from class org.bzdev.devqsim.SimObjectFactory
addToTimelineResponse, getSimulation
Methods inherited from class org.bzdev.obnaming.NamedObjectFactory
add, add, add, add, add, add, add, add, addDocResourceBundle, addDocResourceBundle, addJDoc, addJDoc, addLabelResourceBundle, addLabelResourceBundle, addTipResourceBundle, addTipResourceBundle, arrayInit, canAdd3, configure, configureSupported, containsParm, createObject, createObject, createObject, createObject, createObjects, createObjects, createObjects, createObjects, createObjects, createObjects, doAfterInits, endObjectCreation, getDoc, getFactoryClass, getGLB, getLabel, getLayoutResource, getListedFactories, getLUB, getNextName, getNextNameIndex, getObjectNamer, getParmKeyType, getParmPrefix, getRVMode, getTemplateKeyMap, getTemplateKeyMapForFactories, getTemplateKeyMapForFactories, getTemplateKeyMapForFactories, getTip, getType, glbInRange, initParm, initParms, initParms, isClearOnly, isNamedObject, isRandomVariable, keyType, lubInRange, mustAdd, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newInstance, newInstance, parmNames, parmNameSet, parmPrefixes, remove, remove, remove, remove, remove, remove, remove, removeParm, removeParms, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setDocAPIBase, setInterned, setLayoutResource, setLayoutResource, setNameRoot, setTarget, startObjectCreation, unset, unset, unset, unset, unset, willIntern
-
Constructor Details
-
AnimationShape2DFactory
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
-
newObject
Description copied from class:NamedObjectFactory
Construct a new object. The object will not be initialized. This method is called bycreateObject()
andcreateObjects
unless these methods are overridden. Subclasses should callwillIntern()
to determine if the object will interned or not, andgetObjectNamer()
to find the object namer. Some subclasses (e.g., org.devqsim.SimObjectFactory) provide a method that will return the object namer cast to the type needed by constructors. In the case of SimObjectFactory, this method is named getSimulation(). For a subclass of SimObjectFactory to create a new object of typeFoo
,newObject
will execute the expression
or an equivalent expression, wherenew Foo(getSimulation(), name, willIntern())
name
is the argument passed tonewObject
.- Specified by:
newObject
in classNamedObjectFactory<AnimationObject2DFactory<AnimationShape2D>,
Simulation, SimObject, AnimationShape2D> - Parameters:
name
- the name of the object to be created- Returns:
- the new object
- See Also:
-