figureone 0.15.10 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/figureone.min.js +1 -1
- package/index.js +79167 -0
- package/package.json +15 -1
- package/types/index.d.ts +132 -0
- package/types/js/figure/Animation/Animation.d.ts +36 -0
- package/types/js/figure/Animation/AnimationBuilder.d.ts +173 -0
- package/types/js/figure/Animation/AnimationManager.d.ts +392 -0
- package/types/js/figure/Animation/AnimationStep/CustomStep.d.ts +99 -0
- package/types/js/figure/Animation/AnimationStep/DelayStep.d.ts +24 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ColorAnimationStep.d.ts +203 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/OpacityAnimationStep.d.ts +220 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PositionAnimationStep.d.ts +124 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PulseAnimationStep.d.ts +137 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PulseTransformAnimationStep.d.ts +52 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/RotationAnimationStep.d.ts +119 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ScaleAnimationStep.d.ts +93 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ScenarioAnimationStep.d.ts +204 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/TransformAnimationStep.d.ts +163 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep.d.ts +56 -0
- package/types/js/figure/Animation/AnimationStep/ParallelAnimationStep.d.ts +70 -0
- package/types/js/figure/Animation/AnimationStep/SerialAnimationStep.d.ts +84 -0
- package/types/js/figure/Animation/AnimationStep/TriggerStep.d.ts +106 -0
- package/types/js/figure/Animation/AnimationStep.d.ts +110 -0
- package/types/js/figure/DrawContext2D.d.ts +9 -0
- package/types/js/figure/DrawingObjects/DrawingObject.d.ts +45 -0
- package/types/js/figure/DrawingObjects/GLObject/GLObject.d.ts +146 -0
- package/types/js/figure/DrawingObjects/HTMLObject/HTMLObject.d.ts +29 -0
- package/types/js/figure/DrawingObjects/TextObject/TextObject.d.ts +94 -0
- package/types/js/figure/DrawingObjects/TextObject/glyphMeasures.d.ts +7 -0
- package/types/js/figure/DrawingObjects/VertexObject/VertexGeneric.d.ts +21 -0
- package/types/js/figure/DrawingObjects/VertexObject/VertexObject.d.ts +0 -0
- package/types/js/figure/DrawingObjects/VertexObject/VertexText.d.ts +34 -0
- package/types/js/figure/Element.d.ts +1212 -0
- package/types/js/figure/Equation/Elements/BaseAnnotationFunction.d.ts +118 -0
- package/types/js/figure/Equation/Elements/BaseEquationFunction.d.ts +20 -0
- package/types/js/figure/Equation/Elements/Bounds.d.ts +49 -0
- package/types/js/figure/Equation/Elements/Color.d.ts +7 -0
- package/types/js/figure/Equation/Elements/Container.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Element.d.ts +95 -0
- package/types/js/figure/Equation/Elements/Fraction.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Lines.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Matrix.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Offset.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Scale.d.ts +5 -0
- package/types/js/figure/Equation/Equation.d.ts +984 -0
- package/types/js/figure/Equation/EquationForm.d.ts +139 -0
- package/types/js/figure/Equation/EquationFunctions.d.ts +3367 -0
- package/types/js/figure/Equation/EquationSymbols.d.ts +1646 -0
- package/types/js/figure/Equation/HTMLEquation.d.ts +56 -0
- package/types/js/figure/Equation/Symbols/AngleBracket.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Arrow.d.ts +17 -0
- package/types/js/figure/Equation/Symbols/Bar.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Box.d.ts +11 -0
- package/types/js/figure/Equation/Symbols/Brace.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Bracket.d.ts +8 -0
- package/types/js/figure/Equation/Symbols/Division.d.ts +8 -0
- package/types/js/figure/Equation/Symbols/Integral.d.ts +7 -0
- package/types/js/figure/Equation/Symbols/Line.d.ts +5 -0
- package/types/js/figure/Equation/Symbols/Product.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Radical.d.ts +9 -0
- package/types/js/figure/Equation/Symbols/SquareBracket.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Strike.d.ts +8 -0
- package/types/js/figure/Equation/Symbols/Sum.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/SymbolNew.d.ts +15 -0
- package/types/js/figure/Equation/Symbols/Vinculum.d.ts +6 -0
- package/types/js/figure/Figure.d.ts +711 -0
- package/types/js/figure/FigureCollections/Angle.d.ts +766 -0
- package/types/js/figure/FigureCollections/Axis.d.ts +517 -0
- package/types/js/figure/FigureCollections/Axis3.d.ts +118 -0
- package/types/js/figure/FigureCollections/Button.d.ts +195 -0
- package/types/js/figure/FigureCollections/EquationLabel.d.ts +77 -0
- package/types/js/figure/FigureCollections/FigureCollections.d.ts +122 -0
- package/types/js/figure/FigureCollections/Legend.d.ts +270 -0
- package/types/js/figure/FigureCollections/Line.d.ts +587 -0
- package/types/js/figure/FigureCollections/Plot.d.ts +558 -0
- package/types/js/figure/FigureCollections/PolyLine.d.ts +487 -0
- package/types/js/figure/FigureCollections/Rectangle.d.ts +235 -0
- package/types/js/figure/FigureCollections/SlideNavigator.d.ts +255 -0
- package/types/js/figure/FigureCollections/Slider.d.ts +155 -0
- package/types/js/figure/FigureCollections/Text.d.ts +307 -0
- package/types/js/figure/FigureCollections/Toggle.d.ts +185 -0
- package/types/js/figure/FigureCollections/Trace.d.ts +237 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitive2DText.d.ts +119 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveGLText.d.ts +94 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveGesture.d.ts +536 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveMorph.d.ts +175 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes.d.ts +788 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes2D.d.ts +1324 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes3D.d.ts +1105 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitives.d.ts +173 -0
- package/types/js/figure/FigurePrimitives/Generic.d.ts +5 -0
- package/types/js/figure/FigurePrimitives/Text.d.ts +17 -0
- package/types/js/figure/FontManager.d.ts +113 -0
- package/types/js/figure/Gesture.d.ts +39 -0
- package/types/js/figure/Recorder/Recorder.d.ts +291 -0
- package/types/js/figure/Recorder/parseState.d.ts +3 -0
- package/types/js/figure/Recorder/recorder.worker.d.ts +1 -0
- package/types/js/figure/Recorder/state.d.ts +7 -0
- package/types/js/figure/SlideNavigator.d.ts +606 -0
- package/types/js/figure/TimeKeeper.d.ts +174 -0
- package/types/js/figure/geometries/arc.d.ts +18 -0
- package/types/js/figure/geometries/arrow.d.ts +215 -0
- package/types/js/figure/geometries/buffer.d.ts +4 -0
- package/types/js/figure/geometries/copy/copy.d.ts +178 -0
- package/types/js/figure/geometries/ellipse.d.ts +17 -0
- package/types/js/figure/geometries/line.d.ts +13 -0
- package/types/js/figure/geometries/lines/corners.d.ts +7 -0
- package/types/js/figure/geometries/lines/dashes.d.ts +23 -0
- package/types/js/figure/geometries/lines/lines.d.ts +31 -0
- package/types/js/figure/geometries/polygon/polygon.d.ts +12 -0
- package/types/js/figure/geometries/rectangle.d.ts +19 -0
- package/types/js/figure/geometries/triangle.d.ts +27 -0
- package/types/js/figure/webgl/Atlas.d.ts +42 -0
- package/types/js/figure/webgl/shaders.d.ts +143 -0
- package/types/js/figure/webgl/target.d.ts +9 -0
- package/types/js/figure/webgl/webgl.d.ts +54 -0
- package/types/js/tools/FunctionMap.d.ts +69 -0
- package/types/js/tools/color.d.ts +11 -0
- package/types/js/tools/colorNames.d.ts +2 -0
- package/types/js/tools/d2/polygon.d.ts +60 -0
- package/types/js/tools/d2/triangles.d.ts +0 -0
- package/types/js/tools/d3/cone.d.ts +57 -0
- package/types/js/tools/d3/cube.d.ts +26 -0
- package/types/js/tools/d3/cylinder.d.ts +45 -0
- package/types/js/tools/d3/line3.d.ts +55 -0
- package/types/js/tools/d3/prism.d.ts +49 -0
- package/types/js/tools/d3/revolve.d.ts +87 -0
- package/types/js/tools/d3/sphere.d.ts +33 -0
- package/types/js/tools/d3/surface.d.ts +47 -0
- package/types/js/tools/g2.d.ts +242 -0
- package/types/js/tools/geometry/Bounds.d.ts +446 -0
- package/types/js/tools/geometry/Line.d.ts +314 -0
- package/types/js/tools/geometry/Path.d.ts +67 -0
- package/types/js/tools/geometry/Plane.d.ts +201 -0
- package/types/js/tools/geometry/Point.d.ts +359 -0
- package/types/js/tools/geometry/Rect.d.ts +115 -0
- package/types/js/tools/geometry/Transform.d.ts +623 -0
- package/types/js/tools/geometry/angle.d.ts +105 -0
- package/types/js/tools/geometry/common.d.ts +9 -0
- package/types/js/tools/geometry/coordinates.d.ts +30 -0
- package/types/js/tools/geometry/deceleration.d.ts +13 -0
- package/types/js/tools/geometry/polygon.d.ts +4 -0
- package/types/js/tools/geometry/quaternion.d.ts +15 -0
- package/types/js/tools/geometry/scene.d.ts +282 -0
- package/types/js/tools/geometry/tools.d.ts +8 -0
- package/types/js/tools/geometry/types.d.ts +2 -0
- package/types/js/tools/getCssColors.d.ts +1 -0
- package/types/js/tools/getCssVariables.d.ts +4 -0
- package/types/js/tools/getImageData.d.ts +1 -0
- package/types/js/tools/getScssColors.d.ts +2 -0
- package/types/js/tools/htmlGenerator.d.ts +85 -0
- package/types/js/tools/m2.d.ts +24 -0
- package/types/js/tools/m3.d.ts +71 -0
- package/types/js/tools/math.d.ts +112 -0
- package/types/js/tools/morph.d.ts +651 -0
- package/types/js/tools/styleSheets.d.ts +3 -0
- package/types/js/tools/tools.d.ts +281 -0
- package/types/js/tools/types.d.ts +305 -0
- package/figureone.worker.js +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Transform } from '../../../../tools/g2';
|
|
2
|
+
import type { TypeParsablePoint, TypeParsableTransform } from '../../../../tools/g2';
|
|
3
|
+
import type { OBJ_ElementAnimationStep } from '../ElementAnimationStep';
|
|
4
|
+
import ElementAnimationStep from '../ElementAnimationStep';
|
|
5
|
+
import type { AnimationStartTime } from '../../AnimationManager';
|
|
6
|
+
import type { OBJ_TranslationPath } from '../../../../tools/geometry/Path';
|
|
7
|
+
export type OBJ_PulseTransformAnimationStep = {
|
|
8
|
+
start?: Array<Transform>;
|
|
9
|
+
target?: Array<Transform>;
|
|
10
|
+
path?: OBJ_TranslationPath;
|
|
11
|
+
rotDirection: 0 | 1 | -1 | 2;
|
|
12
|
+
clipRotationTo: '0to360' | '-180to180' | null;
|
|
13
|
+
velocity?: Transform | number | {
|
|
14
|
+
position?: TypeParsablePoint | number;
|
|
15
|
+
translation?: TypeParsablePoint | number;
|
|
16
|
+
rotation?: number;
|
|
17
|
+
scale?: TypeParsablePoint | number;
|
|
18
|
+
transform?: TypeParsableTransform;
|
|
19
|
+
} | null;
|
|
20
|
+
maxDuration?: number;
|
|
21
|
+
zeroDurationThreshold?: number;
|
|
22
|
+
} & OBJ_ElementAnimationStep;
|
|
23
|
+
export default class PulseTransformAnimationStep extends ElementAnimationStep {
|
|
24
|
+
transform: {
|
|
25
|
+
start: Array<Transform>;
|
|
26
|
+
delta: Array<Transform>;
|
|
27
|
+
target: Array<Transform>;
|
|
28
|
+
rotDirection: 0 | 1 | -1 | 2;
|
|
29
|
+
path: OBJ_TranslationPath;
|
|
30
|
+
velocity: Transform | number | {
|
|
31
|
+
position?: TypeParsablePoint | number;
|
|
32
|
+
translation?: TypeParsablePoint | number;
|
|
33
|
+
rotation?: number;
|
|
34
|
+
scale?: TypeParsablePoint | number;
|
|
35
|
+
transform?: TypeParsableTransform;
|
|
36
|
+
} | null | undefined;
|
|
37
|
+
clipRotationTo: '0to360' | '-180to180' | null;
|
|
38
|
+
maxDuration: number | null | undefined;
|
|
39
|
+
zeroDurationThreshold: number;
|
|
40
|
+
};
|
|
41
|
+
constructor(...optionsIn: Array<OBJ_PulseTransformAnimationStep>);
|
|
42
|
+
spread(transforms: Array<Transform>, toNum: number): Transform[];
|
|
43
|
+
setStartAndTarget(): void;
|
|
44
|
+
calculateStartTargetDelta(): void;
|
|
45
|
+
_getStateProperties(): string[];
|
|
46
|
+
_getStateName(): string;
|
|
47
|
+
getVelocityTransform(): Transform;
|
|
48
|
+
start(startTime?: AnimationStartTime | null): void;
|
|
49
|
+
setFrame(deltaTime: number): void;
|
|
50
|
+
setToEnd(): void;
|
|
51
|
+
_dup(): PulseTransformAnimationStep;
|
|
52
|
+
}
|
package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/RotationAnimationStep.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { OBJ_ElementAnimationStep } from '../ElementAnimationStep';
|
|
2
|
+
import ElementAnimationStep from '../ElementAnimationStep';
|
|
3
|
+
import type { AnimationStartTime } from '../../AnimationManager';
|
|
4
|
+
/**
|
|
5
|
+
* {@link RotationAnimationStep} step options object.
|
|
6
|
+
*
|
|
7
|
+
* The {@link RotationAnimationStep} animates the rotation value of a the first
|
|
8
|
+
* rotation component in a {@link Transform}.
|
|
9
|
+
*
|
|
10
|
+
* To rotate from a `start` rotation to a `target` rotation use the
|
|
11
|
+
* `start`, `delta` and/or `target` properties.
|
|
12
|
+
*
|
|
13
|
+
* If `start` is not defined, the current rotation angle (when the animation
|
|
14
|
+
* is started) will be used as `start`.
|
|
15
|
+
*
|
|
16
|
+
* Either `target` or `delta` (from start) can be used to define the target.
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
* The animation can either move to the target with a `duration`, or the
|
|
20
|
+
* `duration` can be determined by a `velocity`.
|
|
21
|
+
*
|
|
22
|
+
* Rotation animation targets can also be created with `velocity`, `start` and
|
|
23
|
+
* `duration`. In this case, the rotation angles will grow with `velocity`. If
|
|
24
|
+
* `duration` is null, then rotation duration will continue indefinitely until
|
|
25
|
+
* the animation is cancelled.
|
|
26
|
+
*
|
|
27
|
+
* @extends OBJ_ElementAnimationStep
|
|
28
|
+
*
|
|
29
|
+
* @property {number} [start] start rotation - current
|
|
30
|
+
* rotation used if undefined
|
|
31
|
+
* @property {number} [target] target rotation
|
|
32
|
+
* @property {number} [delta] a delta rotation that can be
|
|
33
|
+
* used to define `target` if `target` is undefined
|
|
34
|
+
* @property {null | number} [velocity] velocity of
|
|
35
|
+
* rotation can either define the `duration` of a rotation if `target` or
|
|
36
|
+
* `delta` is defined, or can define the `target` of a rotation if `duration`
|
|
37
|
+
* is defined. If `duration` is null, then velocity determines the change in
|
|
38
|
+
* rotation over time (`null`)
|
|
39
|
+
* @property {number | null} [maxDuration] maximum duration to clip animation
|
|
40
|
+
* to where `null` is unlimited (`null`)
|
|
41
|
+
*
|
|
42
|
+
* @see {@link RotationAnimationStep} for description and examples
|
|
43
|
+
* @interface
|
|
44
|
+
* @group Misc Animation
|
|
45
|
+
*/
|
|
46
|
+
export type OBJ_RotationAnimationStep = {
|
|
47
|
+
start?: number;
|
|
48
|
+
target?: number;
|
|
49
|
+
delta?: number;
|
|
50
|
+
velocity?: number | null;
|
|
51
|
+
maxDuration?: number | null;
|
|
52
|
+
} & OBJ_ElementAnimationStep;
|
|
53
|
+
/**
|
|
54
|
+
* Rotation animation step
|
|
55
|
+
*
|
|
56
|
+
* 
|
|
57
|
+
*
|
|
58
|
+
* The rotation animation step animates the first {@link Rotation} transform
|
|
59
|
+
* in the {@link FigureElement}'s {@link Transform}.
|
|
60
|
+
*
|
|
61
|
+
* By default, the rotation will start with the element's current rotation.
|
|
62
|
+
*
|
|
63
|
+
* Use either `delta` or `target` to define it's end point
|
|
64
|
+
*
|
|
65
|
+
*
|
|
66
|
+
* @extends ElementAnimationStep
|
|
67
|
+
* @param {OBJ_RotationAnimationStep} options
|
|
68
|
+
*
|
|
69
|
+
*
|
|
70
|
+
* @see To test examples, append them to the
|
|
71
|
+
* <a href="#animation-boilerplate">boilerplate</a>
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Using duration
|
|
75
|
+
* p.animations.new()
|
|
76
|
+
* .rotation({ target: Math.PI, duration: 2 })
|
|
77
|
+
* .start();
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* // Using velocity
|
|
81
|
+
* p.animations.new()
|
|
82
|
+
* .rotation({ target: Math.PI, velocity: Math.PI / 2 })
|
|
83
|
+
* .start();
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* // Different ways to create a stand-alone step
|
|
87
|
+
* const step1 = p.animations.rotation({ target: Math.PI, duration: 2 });
|
|
88
|
+
* const step2 = new Fig.Animation.RotationAnimationStep({
|
|
89
|
+
* element: p,
|
|
90
|
+
* target: 0,
|
|
91
|
+
* duration: 2,
|
|
92
|
+
* });
|
|
93
|
+
*
|
|
94
|
+
* p.animations.new()
|
|
95
|
+
* .then(step1)
|
|
96
|
+
* .then(step2)
|
|
97
|
+
* .start();
|
|
98
|
+
* @group Animation
|
|
99
|
+
*/
|
|
100
|
+
export default class RotationAnimationStep extends ElementAnimationStep {
|
|
101
|
+
rotation: {
|
|
102
|
+
start: number;
|
|
103
|
+
delta: number;
|
|
104
|
+
target: number;
|
|
105
|
+
velocity: number;
|
|
106
|
+
maxDuration: number | null | undefined;
|
|
107
|
+
clipTo: '0to360' | '-180to180' | null;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* @hideconstructor
|
|
111
|
+
*/
|
|
112
|
+
constructor(...optionsIn: Array<OBJ_RotationAnimationStep>);
|
|
113
|
+
_getStateProperties(): string[];
|
|
114
|
+
_getStateName(): string;
|
|
115
|
+
start(startTime?: AnimationStartTime | null): void;
|
|
116
|
+
setFrame(deltaTime: number): void;
|
|
117
|
+
setToEnd(): void;
|
|
118
|
+
_dup(): RotationAnimationStep;
|
|
119
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Point } from '../../../../tools/g2';
|
|
2
|
+
import type { OBJ_ElementAnimationStep } from '../ElementAnimationStep';
|
|
3
|
+
import ElementAnimationStep from '../ElementAnimationStep';
|
|
4
|
+
import type { AnimationStartTime } from '../../AnimationManager';
|
|
5
|
+
/**
|
|
6
|
+
* {@link ScaleAnimationStep} options object
|
|
7
|
+
*
|
|
8
|
+
* @extends OBJ_ElementAnimationStep
|
|
9
|
+
*
|
|
10
|
+
* @property {TypeParsablePoint | number} [start]
|
|
11
|
+
* @property {TypeParsablePoint | number} [target]
|
|
12
|
+
* @property {TypeParsablePoint | number} [delta]
|
|
13
|
+
* @property {null | TypeParsablePoint | number} [velocity] velocity of scale
|
|
14
|
+
* overrides `duration` - `null` to use `duration` (`null`)
|
|
15
|
+
* @property {number | null} [maxDuration] maximum duration to clip animation
|
|
16
|
+
* to where `null` is unlimited (`null`)
|
|
17
|
+
* @interface
|
|
18
|
+
* @group Misc Animation
|
|
19
|
+
*/
|
|
20
|
+
export type OBJ_ScaleAnimationStep = {
|
|
21
|
+
start?: Point | number;
|
|
22
|
+
target?: Point | number;
|
|
23
|
+
delta?: Point | number;
|
|
24
|
+
velocity?: Point | number;
|
|
25
|
+
maxDuration?: number | null | undefined;
|
|
26
|
+
} & OBJ_ElementAnimationStep;
|
|
27
|
+
/**
|
|
28
|
+
* Scale Animation Step
|
|
29
|
+
*
|
|
30
|
+
* 
|
|
31
|
+
*
|
|
32
|
+
* The scale animation step animates the first {@link Scale} transform
|
|
33
|
+
* in the {@link FigureElement}'s {@link Transform}.
|
|
34
|
+
*
|
|
35
|
+
* By default, the scale will start with the element's current scale.
|
|
36
|
+
*
|
|
37
|
+
* Use either `delta` or `target` to define it's end point.
|
|
38
|
+
*
|
|
39
|
+
* Scale can be defined as either a point or number. If number,
|
|
40
|
+
* both x and y scale terms will be the same.
|
|
41
|
+
*
|
|
42
|
+
* @extends ElementAnimationStep
|
|
43
|
+
* @param {OBJ_ScaleAnimationStep} options
|
|
44
|
+
*
|
|
45
|
+
* @see To test examples, append them to the
|
|
46
|
+
* <a href="#animation-boilerplate">boilerplate</a>
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* // Using duration
|
|
50
|
+
* p.animations.new()
|
|
51
|
+
* .scale({ target: 2, duration: 2 })
|
|
52
|
+
* .start();
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Using velocity
|
|
56
|
+
* p.animations.new()
|
|
57
|
+
* .scale({ target: 2, velocity: 0.5 })
|
|
58
|
+
* .start();
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Different ways to create a stand-alone step
|
|
62
|
+
* const step1 = p.animations.scale({ target: 1.5, duration: 2 });
|
|
63
|
+
* const step2 = new Fig.Animation.ScaleAnimationStep({
|
|
64
|
+
* element: p,
|
|
65
|
+
* target: 1,
|
|
66
|
+
* duration: 2,
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* p.animations.new()
|
|
70
|
+
* .then(step1)
|
|
71
|
+
* .then(step2)
|
|
72
|
+
* .start();
|
|
73
|
+
* @group Animation
|
|
74
|
+
*/
|
|
75
|
+
export default class ScaleAnimationStep extends ElementAnimationStep {
|
|
76
|
+
scale: {
|
|
77
|
+
start: Point | null | undefined;
|
|
78
|
+
delta: Point | null | undefined;
|
|
79
|
+
target: Point | null | undefined;
|
|
80
|
+
velocity: Point | null | undefined;
|
|
81
|
+
maxDuration: number | null | undefined;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* @hideconstructor
|
|
85
|
+
*/
|
|
86
|
+
constructor(...optionsIn: Array<OBJ_ScaleAnimationStep>);
|
|
87
|
+
_getStateProperties(): string[];
|
|
88
|
+
_getStateName(): string;
|
|
89
|
+
start(startTime?: AnimationStartTime | null): void;
|
|
90
|
+
setFrame(deltaTime: number): void;
|
|
91
|
+
setToEnd(): void;
|
|
92
|
+
_dup(): ScaleAnimationStep;
|
|
93
|
+
}
|
package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ScenarioAnimationStep.d.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Transform } from '../../../../tools/g2';
|
|
2
|
+
import type { OBJ_TranslationPath, TypeParsableTransform, TypeParsablePoint } from '../../../../tools/g2';
|
|
3
|
+
import type { OBJ_ElementAnimationStep, AnimationProgression } from '../ElementAnimationStep';
|
|
4
|
+
import { ParallelAnimationStep } from '../ParallelAnimationStep';
|
|
5
|
+
import type { FigureElement, OBJ_Scenario } from '../../../Element';
|
|
6
|
+
import type { AnimationStartTime } from '../../AnimationManager';
|
|
7
|
+
import type { TypeColor } from '../../../../tools/types';
|
|
8
|
+
/**
|
|
9
|
+
* Transform, color and visbility scenario definition
|
|
10
|
+
*
|
|
11
|
+
* `translation` will overwirte `position`, and `translation, `position`,
|
|
12
|
+
* rotation` and `scale` overwrite the first equivalent transforms in
|
|
13
|
+
* `transform`
|
|
14
|
+
*
|
|
15
|
+
* @property {TypeParsablePoint} [position]
|
|
16
|
+
* @property {TypeParsablePoint} [translation]
|
|
17
|
+
* @property {TypeParsablePoint | number} [scale]
|
|
18
|
+
* @property {number} [rotation]
|
|
19
|
+
* @property {TypeParsableTransform} [transform]
|
|
20
|
+
* @property {TypeColor} [color]
|
|
21
|
+
* @property {number} [opacity]
|
|
22
|
+
* @interface
|
|
23
|
+
* @group Misc Animation
|
|
24
|
+
*/
|
|
25
|
+
export type OBJ_ScenarioVelocity = {
|
|
26
|
+
position?: TypeParsablePoint | number;
|
|
27
|
+
translation?: TypeParsablePoint | number;
|
|
28
|
+
rotation?: number;
|
|
29
|
+
scale?: TypeParsablePoint | number;
|
|
30
|
+
transform?: TypeParsableTransform;
|
|
31
|
+
color?: number;
|
|
32
|
+
opacity?: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* {@link ScenarioAnimationStep} options object
|
|
36
|
+
*
|
|
37
|
+
* @extends OBJ_ElementAnimationStep
|
|
38
|
+
*
|
|
39
|
+
* @property {string | OBJ_Scenario} [start]
|
|
40
|
+
* @property {string | OBJ_Scenario} [target]
|
|
41
|
+
* @property {null | string | OBJ_ScenarioVelocity} [velocity] velocity
|
|
42
|
+
* will override duration with a calculated duration based on
|
|
43
|
+
* the `start`, `target` and `velocity`. If `null` is used
|
|
44
|
+
* then `duration` will not be overriden. Any scenario velocity elements that
|
|
45
|
+
* are undefined will default to 1 (`null`)
|
|
46
|
+
* @property {number | null} [maxDuration] maximum duration to clip animation
|
|
47
|
+
* to where `null` is unlimited (`null`)
|
|
48
|
+
* @property {number} [zeroDurationThreshold] value considered 0 to stop
|
|
49
|
+
* animation - this is useful when numbers get very small and rounding problems
|
|
50
|
+
* with javascripts floating point implementation arise
|
|
51
|
+
* @property {OBJ_TranslationPath} [path] translation path style and options
|
|
52
|
+
* (`{ style: 'linear' }`)
|
|
53
|
+
* @property {0 | 1 | -1 | 2} [rotDirection] where `0` is quickest direction,
|
|
54
|
+
* `1` is positive of CCW direction, `-1` is negative of CW direction and `2` is
|
|
55
|
+
* whichever direction doesn't pass through angle 0.
|
|
56
|
+
* @property {'0to360' | '-180to180' | null} [clipRotationTo]
|
|
57
|
+
* @property {'linear' | 'easeinout' | 'easein' | 'easeout' | AnimationProgression} [progression]
|
|
58
|
+
* (`'easeinout'`)
|
|
59
|
+
* @interface
|
|
60
|
+
* @group Misc Animation
|
|
61
|
+
*/
|
|
62
|
+
export type OBJ_ScenarioAnimationStep = {
|
|
63
|
+
start?: string | OBJ_Scenario;
|
|
64
|
+
target?: string | OBJ_Scenario;
|
|
65
|
+
velocity?: OBJ_ScenarioVelocity;
|
|
66
|
+
maxDuration?: number;
|
|
67
|
+
zeroDurationThreshold?: number;
|
|
68
|
+
allDurationsSame?: boolean;
|
|
69
|
+
path?: OBJ_TranslationPath;
|
|
70
|
+
rotDirection: 0 | 1 | -1 | 2;
|
|
71
|
+
clipRotationTo: '0to360' | '-180to180' | null;
|
|
72
|
+
progression: 'linear' | 'easeinout' | 'easein' | 'easeout' | AnimationProgression;
|
|
73
|
+
} & OBJ_ElementAnimationStep;
|
|
74
|
+
/**
|
|
75
|
+
* {@link ScenarioAnimationStep} options object
|
|
76
|
+
*
|
|
77
|
+
* @extends OBJ_ElementAnimationStep
|
|
78
|
+
*
|
|
79
|
+
* @property {string} [target]
|
|
80
|
+
* @property {null | string | OBJ_ScenarioVelocity} [velocity] velocity
|
|
81
|
+
* will override duration with a calculated duration based on
|
|
82
|
+
* the `start`, `target` and `velocity`. If `null` is used
|
|
83
|
+
* then `duration` will not be overriden. Any scenario velocity elements that
|
|
84
|
+
* are undefined will default to 1 (`null`)
|
|
85
|
+
* @property {number | null} [maxDuration] maximum duration to clip animation
|
|
86
|
+
* to where `null` is unlimited (`null`)
|
|
87
|
+
* @property {number} [zeroDurationThreshold] value considered 0 to stop
|
|
88
|
+
* animation - this is useful when numbers get very small and rounding problems
|
|
89
|
+
* with javascripts floating point implementation arise
|
|
90
|
+
* @property {OBJ_TranslationPath} [path] translation path style and options
|
|
91
|
+
* (`{ style: 'linear' }`)
|
|
92
|
+
* @property {0 | 1 | -1 | 2} [rotDirection] where `0` is quickest direction,
|
|
93
|
+
* `1` is positive of CCW direction, `-1` is negative of CW direction and `2` is
|
|
94
|
+
* whichever direction doesn't pass through angle 0.
|
|
95
|
+
* @property {'0to360' | '-180to180' | null} [clipRotationTo]
|
|
96
|
+
* @property {'linear' | 'easeinout' | 'easein' | 'easeout' | AnimationProgression} [progression]
|
|
97
|
+
* (`'easeinout'`)
|
|
98
|
+
* @interface
|
|
99
|
+
* @group Misc Animation
|
|
100
|
+
*/
|
|
101
|
+
export type OBJ_ScenariosAnimationStep = {
|
|
102
|
+
target?: string;
|
|
103
|
+
velocity?: OBJ_ScenarioVelocity;
|
|
104
|
+
maxDuration?: number;
|
|
105
|
+
zeroDurationThreshold?: number;
|
|
106
|
+
allDurationsSame?: boolean;
|
|
107
|
+
path?: OBJ_TranslationPath;
|
|
108
|
+
rotDirection: 0 | 1 | -1 | 2;
|
|
109
|
+
clipRotationTo: '0to360' | '-180to180' | null;
|
|
110
|
+
progression: 'linear' | 'easeinout' | 'easein' | 'easeout' | AnimationProgression;
|
|
111
|
+
} & OBJ_ElementAnimationStep;
|
|
112
|
+
/**
|
|
113
|
+
* Scenario Animation Step
|
|
114
|
+
*
|
|
115
|
+
* 
|
|
116
|
+
*
|
|
117
|
+
* A scenario defines an element's transform and color and can be used to make
|
|
118
|
+
* code more readable and reusable.
|
|
119
|
+
*
|
|
120
|
+
* By default, the scenario will start with the element's current transform and
|
|
121
|
+
* color.
|
|
122
|
+
*
|
|
123
|
+
* @extends ElementAnimationStep
|
|
124
|
+
* @param {OBJ_ScenarioAnimationStep} options
|
|
125
|
+
*
|
|
126
|
+
* @see To test examples, append them to the
|
|
127
|
+
* <a href="#animation-boilerplate">boilerplate</a>
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* // NOTE - use these scenario definitions for all examples below
|
|
131
|
+
* p.scenarios['center'] = { position: [0, 0], scale: [1, 1], color: [1, 0, 0, 1] };
|
|
132
|
+
* p.scenarios['right'] = { position: [1, 0], scale: [2, 1], color: [0, 0, 1, 1] };
|
|
133
|
+
* p.scenarios['bottom'] = { position: [0, -0.5], scale: [0.5, 1], color: [0, 0.5, 0, 1] };
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* // Using duration
|
|
137
|
+
* p.animations.new()
|
|
138
|
+
* .scenario({ target: 'right', duration: 2 })
|
|
139
|
+
* .scenario({ target: 'bottom', duration: 2 })
|
|
140
|
+
* .scenario({ target: 'center', duration: 2 })
|
|
141
|
+
* .start();
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* // Using velocity
|
|
145
|
+
* p.animations.new()
|
|
146
|
+
* .scenario({
|
|
147
|
+
* target: 'right',
|
|
148
|
+
* velocity: { position: 0.5, scale: 0.2 },
|
|
149
|
+
* })
|
|
150
|
+
* .scenario({ target: 'bottom', velocity: { position: 0.5 } })
|
|
151
|
+
* .scenario({ target: 'center', velocity: { color: 0.2 } })
|
|
152
|
+
* .start();
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* // Different ways to create a stand-alone step
|
|
156
|
+
* const step1 = p.animations.scenario({
|
|
157
|
+
* target: 'right',
|
|
158
|
+
* duration: 2,
|
|
159
|
+
* });
|
|
160
|
+
* const step2 = new Fig.Animation.ScenarioAnimationStep({
|
|
161
|
+
* element: p,
|
|
162
|
+
* target: 'bottom',
|
|
163
|
+
* duration: 2,
|
|
164
|
+
* });
|
|
165
|
+
*
|
|
166
|
+
* p.animations.new()
|
|
167
|
+
* .then(step1)
|
|
168
|
+
* .then(step2)
|
|
169
|
+
* .start();
|
|
170
|
+
* @group Animation
|
|
171
|
+
*/
|
|
172
|
+
export default class ScenarioAnimationStep extends ParallelAnimationStep {
|
|
173
|
+
element: FigureElement | null | undefined;
|
|
174
|
+
scenario: {
|
|
175
|
+
start: (string | OBJ_Scenario) | null | undefined;
|
|
176
|
+
target: (string | OBJ_Scenario) | null | undefined;
|
|
177
|
+
rotDirection: 0 | 1 | -1 | 2;
|
|
178
|
+
path: OBJ_TranslationPath;
|
|
179
|
+
velocity: OBJ_ScenarioVelocity | null | undefined;
|
|
180
|
+
maxDuration: number | null | undefined;
|
|
181
|
+
allDurationsSame: boolean;
|
|
182
|
+
zeroDurationThreshold: number;
|
|
183
|
+
clipRotationTo: '0to360' | '-180to180' | null;
|
|
184
|
+
progression: 'linear' | 'easeinout' | 'easein' | 'easeout' | AnimationProgression;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* @hideconstructor
|
|
188
|
+
*/
|
|
189
|
+
constructor(...optionsIn: Array<OBJ_ScenarioAnimationStep>);
|
|
190
|
+
_getStateProperties(): string[];
|
|
191
|
+
_getStateName(): string;
|
|
192
|
+
getDuration(start: {
|
|
193
|
+
transform?: Transform;
|
|
194
|
+
color?: TypeColor;
|
|
195
|
+
isShown?: boolean;
|
|
196
|
+
opacity?: number;
|
|
197
|
+
}, target: {
|
|
198
|
+
transform?: Transform;
|
|
199
|
+
color?: TypeColor;
|
|
200
|
+
isShown?: boolean;
|
|
201
|
+
}): number[];
|
|
202
|
+
start(startTime?: AnimationStartTime): void;
|
|
203
|
+
_dup(): ScenarioAnimationStep;
|
|
204
|
+
}
|
package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/TransformAnimationStep.d.ts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animations are simply interpolating each value within a rotation definition
|
|
3
|
+
* independently (either between a `start` and `target` or from a `start` with
|
|
4
|
+
* `velocity`). Therefore, animating any values that belong to vectors
|
|
5
|
+
* (direction ('dir' or 'rd'), change of basis ('rbasis' or 'rb'), or the axis
|
|
6
|
+
* of axis/angle) may result in unexpected animations. For example, if animating
|
|
7
|
+
* a rotation direction from [1, 0, 0] to [-1, 0, 0] it might be expected that
|
|
8
|
+
* a π radians rotation would occur. Instead, it will look like no rotation
|
|
9
|
+
* will have started, then a π rotation will happen in a single frame, and then
|
|
10
|
+
* it will look stationary again. This is because only the x component of the
|
|
11
|
+
* direction vector will change each animation frame. As a rotation direciton
|
|
12
|
+
* that is [0.5, 0, 0] is the same as [1, 0, 0], then for half the animation it
|
|
13
|
+
* will look like nothing is changing. When the x component cross from the 0
|
|
14
|
+
* point, the element's rotation will instantly flip. Then for the second have
|
|
15
|
+
* of the rotation as the x component gets more negative it will once again
|
|
16
|
+
* look stationary.
|
|
17
|
+
*
|
|
18
|
+
* If wanting to animate a direction vector, use {@link directionToAxisAngle}
|
|
19
|
+
* or {@link angleFromVectors} and then use a axis/angle rotation
|
|
20
|
+
* keeping the axis constant. If wanting to animate a change of basis rotation,
|
|
21
|
+
* then use a {@link CustomAnimationStep} to manage how to change the basis
|
|
22
|
+
* vectors over time.
|
|
23
|
+
*/
|
|
24
|
+
import { Transform } from '../../../../tools/g2';
|
|
25
|
+
import type { OBJ_TranslationPath } from '../../../../tools/g2';
|
|
26
|
+
import type { OBJ_ElementAnimationStep } from '../ElementAnimationStep';
|
|
27
|
+
import ElementAnimationStep from '../ElementAnimationStep';
|
|
28
|
+
import type { AnimationStartTime } from '../../AnimationManager';
|
|
29
|
+
/**
|
|
30
|
+
* {@link TransformAnimationStep} options object
|
|
31
|
+
*
|
|
32
|
+
* @extends OBJ_ElementAnimationStep
|
|
33
|
+
*
|
|
34
|
+
* @property {TypeParsableTransform} [start]
|
|
35
|
+
* @property {TypeParsableTransform} [target]
|
|
36
|
+
* @property {TypeParsableTransform} [delta]
|
|
37
|
+
* @property {null | TypeParsableTransform} [velocity] velocity of
|
|
38
|
+
* transform overrides `duration` - `null` to use `duration` (`null`)
|
|
39
|
+
* @property {OBJ_TranslationPath} [path] translation path style and options
|
|
40
|
+
* (`{ style: 'linear' }`)
|
|
41
|
+
* @property {0 | 1 | -1 | 2} [rotDirection] where `0` is quickest direction,
|
|
42
|
+
* `1` is positive of CCW direction, `-1` is negative of CW direction and `2` is
|
|
43
|
+
* whichever direction doesn't pass through angle 0 (`0`).
|
|
44
|
+
* @property {'0to360' | '-180to180' | null} [clipRotationTo]
|
|
45
|
+
* @property {number | null} [maxDuration] maximum duration to clip animation
|
|
46
|
+
* to where `null` is unlimited (`null`)
|
|
47
|
+
* @interface
|
|
48
|
+
* @group Misc Animation
|
|
49
|
+
*/
|
|
50
|
+
export type OBJ_TransformAnimationStep = {
|
|
51
|
+
start?: Transform;
|
|
52
|
+
target?: Transform;
|
|
53
|
+
delta?: Transform;
|
|
54
|
+
path?: OBJ_TranslationPath;
|
|
55
|
+
rotDirection?: 0 | 1 | -1 | 2;
|
|
56
|
+
clipRotationTo?: '0to360' | '-180to180' | null;
|
|
57
|
+
velocity?: Transform | number | null | undefined;
|
|
58
|
+
maxDuration?: number;
|
|
59
|
+
} & OBJ_ElementAnimationStep;
|
|
60
|
+
/**
|
|
61
|
+
* Transform Animation Step
|
|
62
|
+
*
|
|
63
|
+
* 
|
|
64
|
+
*
|
|
65
|
+
* By default, the transform will start with the element's current transform.
|
|
66
|
+
*
|
|
67
|
+
* A {@link Transform} chains many transform links where each link might be
|
|
68
|
+
* a {@link Rotation}, {@link Scale} or {@link Translation} transform.
|
|
69
|
+
*
|
|
70
|
+
* `start`, `target` and `delta` should have the same order of transform links
|
|
71
|
+
* as the `element`'s transform.
|
|
72
|
+
*
|
|
73
|
+
* The {@link TransformAnimationStep} will animate each of these links with the
|
|
74
|
+
* same duration. If `velocity` is used to calculate the duration, then the link
|
|
75
|
+
* with the longest duration will define the duration of the animation.
|
|
76
|
+
* `velocity` can either be a transform with the same order of transform links
|
|
77
|
+
* as the `element` or it can be a constant value, which will be applied to
|
|
78
|
+
* all transform links. `velocity` cannot be 0.
|
|
79
|
+
*
|
|
80
|
+
* Use either `delta` or `target` to define it's end point of the animation.
|
|
81
|
+
*
|
|
82
|
+
* @extends ElementAnimationStep
|
|
83
|
+
* @param {OBJ_TransformAnimationStep} options
|
|
84
|
+
*
|
|
85
|
+
* @see To test examples, append them to the
|
|
86
|
+
* <a href="#animation-boilerplate">boilerplate</a>
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* // Using duration
|
|
90
|
+
* p.animations.new()
|
|
91
|
+
* .transform({
|
|
92
|
+
* target: new Fig.Transform().scale(2, 2).rotate(0.5).translate(1, 0),
|
|
93
|
+
* duration: 2,
|
|
94
|
+
* })
|
|
95
|
+
* .start();
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* // Using velocity as a transform
|
|
99
|
+
* p.animations.new()
|
|
100
|
+
* .transform({
|
|
101
|
+
* target: new Fig.Transform().scale(2, 2).rotate(0.5).translate(1, 0),
|
|
102
|
+
* velocity: new Fig.Transform().scale(0.5, 0.5).rotate(0.25).translate(0.5, 0.5),
|
|
103
|
+
* })
|
|
104
|
+
* .start();
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* // Using velocity as a number
|
|
108
|
+
* p.animations.new()
|
|
109
|
+
* .transform({
|
|
110
|
+
* target: new Fig.Transform().scale(2, 2).rotate(0.5).translate(1, 0),
|
|
111
|
+
* velocity: 0.5,
|
|
112
|
+
* })
|
|
113
|
+
* .start();
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* // Using TypeParsableTransform as transform definition
|
|
117
|
+
* p.animations.new()
|
|
118
|
+
* .transform({
|
|
119
|
+
* target: [['s', 1.5, 1.5], ['r', 0.5], ['t', 1, 0]],
|
|
120
|
+
* duration: 2,
|
|
121
|
+
* })
|
|
122
|
+
* .start();
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* // Different ways to create a stand-alone step
|
|
126
|
+
* const step1 = p.animations.transform({
|
|
127
|
+
* target: [['s', 1.5, 1.5], ['r', 1], ['t', 1, 0]],
|
|
128
|
+
* duration: 2,
|
|
129
|
+
* });
|
|
130
|
+
* const step2 = new Fig.Animation.TransformAnimationStep({
|
|
131
|
+
* element: p,
|
|
132
|
+
* target: [['s', 1, 1], ['r', 0], ['t', 0, 0]],
|
|
133
|
+
* duration: 2,
|
|
134
|
+
* });
|
|
135
|
+
*
|
|
136
|
+
* p.animations.new()
|
|
137
|
+
* .then(step1)
|
|
138
|
+
* .then(step2)
|
|
139
|
+
* .start();
|
|
140
|
+
* @group Animation
|
|
141
|
+
*/
|
|
142
|
+
export default class TransformAnimationStep extends ElementAnimationStep {
|
|
143
|
+
transform: {
|
|
144
|
+
start: Transform;
|
|
145
|
+
delta: Transform;
|
|
146
|
+
target: Transform;
|
|
147
|
+
rotDirection: 0 | 1 | -1 | 2;
|
|
148
|
+
path: OBJ_TranslationPath;
|
|
149
|
+
velocity: Transform | number | null | undefined;
|
|
150
|
+
clipRotationTo: '0to360' | '-180to180' | null;
|
|
151
|
+
maxDuration: number | null | undefined;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* @hideconstructor
|
|
155
|
+
*/
|
|
156
|
+
constructor(...optionsIn: Array<OBJ_TransformAnimationStep>);
|
|
157
|
+
_getStateProperties(): string[];
|
|
158
|
+
_getStateName(): string;
|
|
159
|
+
start(startTime?: AnimationStartTime | null): void;
|
|
160
|
+
setFrame(deltaTime: number): void;
|
|
161
|
+
setToEnd(): void;
|
|
162
|
+
_dup(): TransformAnimationStep;
|
|
163
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { OBJ_AnimationStep } from '../AnimationStep';
|
|
2
|
+
import AnimationStep from '../AnimationStep';
|
|
3
|
+
import type { FigureElement } from '../../Element';
|
|
4
|
+
import type { AnimationStartTime } from '../AnimationManager';
|
|
5
|
+
/**
|
|
6
|
+
* Animation progression function.
|
|
7
|
+
*
|
|
8
|
+
* As the animation time progresses, a percentage of the total animation
|
|
9
|
+
* duration will be passed to this function.
|
|
10
|
+
*
|
|
11
|
+
* This function then calculates and returns the percent progress of the
|
|
12
|
+
* animation.
|
|
13
|
+
*
|
|
14
|
+
* This function can be used to make non-linear progressions of an animation.
|
|
15
|
+
* For instance, it could be used to create a progression that is slowed
|
|
16
|
+
* at the start or end of the animation.
|
|
17
|
+
*
|
|
18
|
+
* @param {number} percent percentage of duration
|
|
19
|
+
* @return {number} percent of animation complete
|
|
20
|
+
* @group Misc Animation
|
|
21
|
+
*/
|
|
22
|
+
export type AnimationProgression = (percent: number) => number;
|
|
23
|
+
/**
|
|
24
|
+
* {@link ElementAnimationStep} options object
|
|
25
|
+
*
|
|
26
|
+
* @extends OBJ_AnimationStep
|
|
27
|
+
* @property {FigureElement} [element]
|
|
28
|
+
* @property {'linear' | 'easeinout' | 'easein' | 'easeout' | AnimationProgression} [progression]
|
|
29
|
+
* how the animation progresses - defaults to `linear` for color, opacity and
|
|
30
|
+
* custom animations and `easeinout` for others
|
|
31
|
+
* @interface
|
|
32
|
+
* @group Misc Animation
|
|
33
|
+
*/
|
|
34
|
+
export type OBJ_ElementAnimationStep = {
|
|
35
|
+
element?: FigureElement;
|
|
36
|
+
type?: 'transform' | 'color' | 'custom' | 'position' | 'rotation' | 'scale' | 'opacity';
|
|
37
|
+
progression?: 'linear' | 'easeinout' | 'easein' | 'easeout' | AnimationProgression;
|
|
38
|
+
} & OBJ_AnimationStep;
|
|
39
|
+
/**
|
|
40
|
+
* Animation Step tied to an element
|
|
41
|
+
*
|
|
42
|
+
* Default values for the animation step will then come from this element.
|
|
43
|
+
*
|
|
44
|
+
* @extends AnimationStep
|
|
45
|
+
* @group Misc Animation
|
|
46
|
+
*/
|
|
47
|
+
export default class ElementAnimationStep extends AnimationStep {
|
|
48
|
+
type: 'transform' | 'color' | 'custom' | 'position' | 'setPosition' | 'opacity';
|
|
49
|
+
progression: ((percent: number, invert?: boolean) => number) | string;
|
|
50
|
+
constructor(optionsIn?: OBJ_ElementAnimationStep);
|
|
51
|
+
fnExec(idOrFn: string | Function | null, ...args: any): any;
|
|
52
|
+
_getStateProperties(): string[];
|
|
53
|
+
getPercentComplete(percentTime: number): any;
|
|
54
|
+
start(startTime?: AnimationStartTime | null): void;
|
|
55
|
+
_dup(): ElementAnimationStep;
|
|
56
|
+
}
|