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.
Files changed (159) hide show
  1. package/figureone.min.js +1 -1
  2. package/index.js +79167 -0
  3. package/package.json +15 -1
  4. package/types/index.d.ts +132 -0
  5. package/types/js/figure/Animation/Animation.d.ts +36 -0
  6. package/types/js/figure/Animation/AnimationBuilder.d.ts +173 -0
  7. package/types/js/figure/Animation/AnimationManager.d.ts +392 -0
  8. package/types/js/figure/Animation/AnimationStep/CustomStep.d.ts +99 -0
  9. package/types/js/figure/Animation/AnimationStep/DelayStep.d.ts +24 -0
  10. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ColorAnimationStep.d.ts +203 -0
  11. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/OpacityAnimationStep.d.ts +220 -0
  12. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PositionAnimationStep.d.ts +124 -0
  13. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PulseAnimationStep.d.ts +137 -0
  14. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PulseTransformAnimationStep.d.ts +52 -0
  15. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/RotationAnimationStep.d.ts +119 -0
  16. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ScaleAnimationStep.d.ts +93 -0
  17. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ScenarioAnimationStep.d.ts +204 -0
  18. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/TransformAnimationStep.d.ts +163 -0
  19. package/types/js/figure/Animation/AnimationStep/ElementAnimationStep.d.ts +56 -0
  20. package/types/js/figure/Animation/AnimationStep/ParallelAnimationStep.d.ts +70 -0
  21. package/types/js/figure/Animation/AnimationStep/SerialAnimationStep.d.ts +84 -0
  22. package/types/js/figure/Animation/AnimationStep/TriggerStep.d.ts +106 -0
  23. package/types/js/figure/Animation/AnimationStep.d.ts +110 -0
  24. package/types/js/figure/DrawContext2D.d.ts +9 -0
  25. package/types/js/figure/DrawingObjects/DrawingObject.d.ts +45 -0
  26. package/types/js/figure/DrawingObjects/GLObject/GLObject.d.ts +146 -0
  27. package/types/js/figure/DrawingObjects/HTMLObject/HTMLObject.d.ts +29 -0
  28. package/types/js/figure/DrawingObjects/TextObject/TextObject.d.ts +94 -0
  29. package/types/js/figure/DrawingObjects/TextObject/glyphMeasures.d.ts +7 -0
  30. package/types/js/figure/DrawingObjects/VertexObject/VertexGeneric.d.ts +21 -0
  31. package/types/js/figure/DrawingObjects/VertexObject/VertexObject.d.ts +0 -0
  32. package/types/js/figure/DrawingObjects/VertexObject/VertexText.d.ts +34 -0
  33. package/types/js/figure/Element.d.ts +1212 -0
  34. package/types/js/figure/Equation/Elements/BaseAnnotationFunction.d.ts +118 -0
  35. package/types/js/figure/Equation/Elements/BaseEquationFunction.d.ts +20 -0
  36. package/types/js/figure/Equation/Elements/Bounds.d.ts +49 -0
  37. package/types/js/figure/Equation/Elements/Color.d.ts +7 -0
  38. package/types/js/figure/Equation/Elements/Container.d.ts +5 -0
  39. package/types/js/figure/Equation/Elements/Element.d.ts +95 -0
  40. package/types/js/figure/Equation/Elements/Fraction.d.ts +5 -0
  41. package/types/js/figure/Equation/Elements/Lines.d.ts +5 -0
  42. package/types/js/figure/Equation/Elements/Matrix.d.ts +5 -0
  43. package/types/js/figure/Equation/Elements/Offset.d.ts +5 -0
  44. package/types/js/figure/Equation/Elements/Scale.d.ts +5 -0
  45. package/types/js/figure/Equation/Equation.d.ts +984 -0
  46. package/types/js/figure/Equation/EquationForm.d.ts +139 -0
  47. package/types/js/figure/Equation/EquationFunctions.d.ts +3367 -0
  48. package/types/js/figure/Equation/EquationSymbols.d.ts +1646 -0
  49. package/types/js/figure/Equation/HTMLEquation.d.ts +56 -0
  50. package/types/js/figure/Equation/Symbols/AngleBracket.d.ts +6 -0
  51. package/types/js/figure/Equation/Symbols/Arrow.d.ts +17 -0
  52. package/types/js/figure/Equation/Symbols/Bar.d.ts +6 -0
  53. package/types/js/figure/Equation/Symbols/Box.d.ts +11 -0
  54. package/types/js/figure/Equation/Symbols/Brace.d.ts +6 -0
  55. package/types/js/figure/Equation/Symbols/Bracket.d.ts +8 -0
  56. package/types/js/figure/Equation/Symbols/Division.d.ts +8 -0
  57. package/types/js/figure/Equation/Symbols/Integral.d.ts +7 -0
  58. package/types/js/figure/Equation/Symbols/Line.d.ts +5 -0
  59. package/types/js/figure/Equation/Symbols/Product.d.ts +6 -0
  60. package/types/js/figure/Equation/Symbols/Radical.d.ts +9 -0
  61. package/types/js/figure/Equation/Symbols/SquareBracket.d.ts +6 -0
  62. package/types/js/figure/Equation/Symbols/Strike.d.ts +8 -0
  63. package/types/js/figure/Equation/Symbols/Sum.d.ts +6 -0
  64. package/types/js/figure/Equation/Symbols/SymbolNew.d.ts +15 -0
  65. package/types/js/figure/Equation/Symbols/Vinculum.d.ts +6 -0
  66. package/types/js/figure/Figure.d.ts +711 -0
  67. package/types/js/figure/FigureCollections/Angle.d.ts +766 -0
  68. package/types/js/figure/FigureCollections/Axis.d.ts +517 -0
  69. package/types/js/figure/FigureCollections/Axis3.d.ts +118 -0
  70. package/types/js/figure/FigureCollections/Button.d.ts +195 -0
  71. package/types/js/figure/FigureCollections/EquationLabel.d.ts +77 -0
  72. package/types/js/figure/FigureCollections/FigureCollections.d.ts +122 -0
  73. package/types/js/figure/FigureCollections/Legend.d.ts +270 -0
  74. package/types/js/figure/FigureCollections/Line.d.ts +587 -0
  75. package/types/js/figure/FigureCollections/Plot.d.ts +558 -0
  76. package/types/js/figure/FigureCollections/PolyLine.d.ts +487 -0
  77. package/types/js/figure/FigureCollections/Rectangle.d.ts +235 -0
  78. package/types/js/figure/FigureCollections/SlideNavigator.d.ts +255 -0
  79. package/types/js/figure/FigureCollections/Slider.d.ts +155 -0
  80. package/types/js/figure/FigureCollections/Text.d.ts +307 -0
  81. package/types/js/figure/FigureCollections/Toggle.d.ts +185 -0
  82. package/types/js/figure/FigureCollections/Trace.d.ts +237 -0
  83. package/types/js/figure/FigurePrimitives/FigureElementPrimitive2DText.d.ts +119 -0
  84. package/types/js/figure/FigurePrimitives/FigureElementPrimitiveGLText.d.ts +94 -0
  85. package/types/js/figure/FigurePrimitives/FigureElementPrimitiveGesture.d.ts +536 -0
  86. package/types/js/figure/FigurePrimitives/FigureElementPrimitiveMorph.d.ts +175 -0
  87. package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes.d.ts +788 -0
  88. package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes2D.d.ts +1324 -0
  89. package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes3D.d.ts +1105 -0
  90. package/types/js/figure/FigurePrimitives/FigurePrimitives.d.ts +173 -0
  91. package/types/js/figure/FigurePrimitives/Generic.d.ts +5 -0
  92. package/types/js/figure/FigurePrimitives/Text.d.ts +17 -0
  93. package/types/js/figure/FontManager.d.ts +113 -0
  94. package/types/js/figure/Gesture.d.ts +39 -0
  95. package/types/js/figure/Recorder/Recorder.d.ts +291 -0
  96. package/types/js/figure/Recorder/parseState.d.ts +3 -0
  97. package/types/js/figure/Recorder/recorder.worker.d.ts +1 -0
  98. package/types/js/figure/Recorder/state.d.ts +7 -0
  99. package/types/js/figure/SlideNavigator.d.ts +606 -0
  100. package/types/js/figure/TimeKeeper.d.ts +174 -0
  101. package/types/js/figure/geometries/arc.d.ts +18 -0
  102. package/types/js/figure/geometries/arrow.d.ts +215 -0
  103. package/types/js/figure/geometries/buffer.d.ts +4 -0
  104. package/types/js/figure/geometries/copy/copy.d.ts +178 -0
  105. package/types/js/figure/geometries/ellipse.d.ts +17 -0
  106. package/types/js/figure/geometries/line.d.ts +13 -0
  107. package/types/js/figure/geometries/lines/corners.d.ts +7 -0
  108. package/types/js/figure/geometries/lines/dashes.d.ts +23 -0
  109. package/types/js/figure/geometries/lines/lines.d.ts +31 -0
  110. package/types/js/figure/geometries/polygon/polygon.d.ts +12 -0
  111. package/types/js/figure/geometries/rectangle.d.ts +19 -0
  112. package/types/js/figure/geometries/triangle.d.ts +27 -0
  113. package/types/js/figure/webgl/Atlas.d.ts +42 -0
  114. package/types/js/figure/webgl/shaders.d.ts +143 -0
  115. package/types/js/figure/webgl/target.d.ts +9 -0
  116. package/types/js/figure/webgl/webgl.d.ts +54 -0
  117. package/types/js/tools/FunctionMap.d.ts +69 -0
  118. package/types/js/tools/color.d.ts +11 -0
  119. package/types/js/tools/colorNames.d.ts +2 -0
  120. package/types/js/tools/d2/polygon.d.ts +60 -0
  121. package/types/js/tools/d2/triangles.d.ts +0 -0
  122. package/types/js/tools/d3/cone.d.ts +57 -0
  123. package/types/js/tools/d3/cube.d.ts +26 -0
  124. package/types/js/tools/d3/cylinder.d.ts +45 -0
  125. package/types/js/tools/d3/line3.d.ts +55 -0
  126. package/types/js/tools/d3/prism.d.ts +49 -0
  127. package/types/js/tools/d3/revolve.d.ts +87 -0
  128. package/types/js/tools/d3/sphere.d.ts +33 -0
  129. package/types/js/tools/d3/surface.d.ts +47 -0
  130. package/types/js/tools/g2.d.ts +242 -0
  131. package/types/js/tools/geometry/Bounds.d.ts +446 -0
  132. package/types/js/tools/geometry/Line.d.ts +314 -0
  133. package/types/js/tools/geometry/Path.d.ts +67 -0
  134. package/types/js/tools/geometry/Plane.d.ts +201 -0
  135. package/types/js/tools/geometry/Point.d.ts +359 -0
  136. package/types/js/tools/geometry/Rect.d.ts +115 -0
  137. package/types/js/tools/geometry/Transform.d.ts +623 -0
  138. package/types/js/tools/geometry/angle.d.ts +105 -0
  139. package/types/js/tools/geometry/common.d.ts +9 -0
  140. package/types/js/tools/geometry/coordinates.d.ts +30 -0
  141. package/types/js/tools/geometry/deceleration.d.ts +13 -0
  142. package/types/js/tools/geometry/polygon.d.ts +4 -0
  143. package/types/js/tools/geometry/quaternion.d.ts +15 -0
  144. package/types/js/tools/geometry/scene.d.ts +282 -0
  145. package/types/js/tools/geometry/tools.d.ts +8 -0
  146. package/types/js/tools/geometry/types.d.ts +2 -0
  147. package/types/js/tools/getCssColors.d.ts +1 -0
  148. package/types/js/tools/getCssVariables.d.ts +4 -0
  149. package/types/js/tools/getImageData.d.ts +1 -0
  150. package/types/js/tools/getScssColors.d.ts +2 -0
  151. package/types/js/tools/htmlGenerator.d.ts +85 -0
  152. package/types/js/tools/m2.d.ts +24 -0
  153. package/types/js/tools/m3.d.ts +71 -0
  154. package/types/js/tools/math.d.ts +112 -0
  155. package/types/js/tools/morph.d.ts +651 -0
  156. package/types/js/tools/styleSheets.d.ts +3 -0
  157. package/types/js/tools/tools.d.ts +281 -0
  158. package/types/js/tools/types.d.ts +305 -0
  159. package/figureone.worker.js +0 -1
@@ -0,0 +1,203 @@
1
+ import type { OBJ_ElementAnimationStep } from '../ElementAnimationStep';
2
+ import type { OBJ_OpacityAnimationStep } from './OpacityAnimationStep';
3
+ import ElementAnimationStep from '../ElementAnimationStep';
4
+ import type { TypeColor } from '../../../../tools/types';
5
+ import type { AnimationStartTime } from '../../AnimationManager';
6
+ /**
7
+ * {@link ColorAnimationStep} options object
8
+ *
9
+ * @extends OBJ_ElementAnimationStep
10
+ * @property {Array<number>} [start]
11
+ * @property {Array<number> | 'dim' | 'undim'} [target] use `dim` to animate to
12
+ * element's `dimColor`, and `undim` to animate to element's `defaultColor`
13
+ * @property {Array<number>} [delta]
14
+ *
15
+ * @interface
16
+ * @group Misc Animation
17
+ */
18
+ export type OBJ_ColorAnimationStep = {
19
+ start?: TypeColor;
20
+ target?: TypeColor | 'dim' | 'undim';
21
+ delta?: TypeColor;
22
+ dissolve?: 'in' | 'out' | null;
23
+ } & OBJ_ElementAnimationStep;
24
+ /**
25
+ * Color animation Step
26
+ *
27
+ * ![](./apiassets/color_animation.gif)
28
+ *
29
+ * By default, the color will start with the element's current color.
30
+ *
31
+ * Use either `delta` or `target` to define the end color
32
+ *
33
+ * In an interactive figure, it is often useful to highlight elements of the
34
+ * figure by coloring them and greying out, or dimming the elements not of
35
+ * interest. As such, a {@link FigureElement} has several color attributes:
36
+ * - color - current color
37
+ * - dimColor - color to dim to
38
+ * - defaultColor - color to undim to
39
+ *
40
+ * The `target` property can accept `'dim'` and `'undim'` as shortcuts to dim
41
+ * or undim the element.
42
+ *
43
+ * In addition, the {@link DimAnimationStep} and {@link UndimAnimationStep} can
44
+ * be used to do the same, which is especially useful when trying to build
45
+ * easy to read code in a complex animation.
46
+ *
47
+ * @extends ElementAnimationStep
48
+ * @param {OBJ_ColorAnimationStep} options
49
+ *
50
+ * @see To test examples, append them to the
51
+ * <a href="#animation-boilerplate">boilerplate</a>
52
+ *
53
+ * @example
54
+ * // Using duration
55
+ * p.animations.new()
56
+ * .color({ target: [0, 0, 1, 1], duration: 1 })
57
+ * .color({ target: [0, 0.8, 0, 1], duration: 1 })
58
+ * .color({ target: [1, 0, 0, 1], duration: 1 })
59
+ * .start();
60
+ *
61
+ * @example
62
+ * // dim and undim an element using dim and undim animation steps
63
+ * p.animations.new()
64
+ * .dim(1)
65
+ * .delay(1)
66
+ * .undim(1)
67
+ * .start();
68
+ *
69
+ * @example
70
+ * // Different ways to create a stand-alone step
71
+ * const step1 = p.animations.color({
72
+ * target: [0, 0, 1, 1],
73
+ * duration: 2,
74
+ * });
75
+ * const step2 = new Fig.Animation.ColorAnimationStep({
76
+ * element: p,
77
+ * target: [0, 0.8, 0, 1],
78
+ * duration: 2,
79
+ * });
80
+ *
81
+ * p.animations.new()
82
+ * .then(step1)
83
+ * .then(step2)
84
+ * .start();
85
+ * @group Animation
86
+ */
87
+ export declare class ColorAnimationStep extends ElementAnimationStep {
88
+ color: {
89
+ start: TypeColor;
90
+ delta: TypeColor;
91
+ target: TypeColor;
92
+ whenComplete: TypeColor;
93
+ dissolve?: 'in' | 'out' | null;
94
+ setDefault?: boolean;
95
+ };
96
+ /**
97
+ * @hideconstructor
98
+ */
99
+ constructor(...options: Array<OBJ_ColorAnimationStep>);
100
+ _getStateProperties(): string[];
101
+ _getStateName(): string;
102
+ start(startTime?: AnimationStartTime | null): void;
103
+ setFrame(deltaTime: number): void;
104
+ setToEnd(): void;
105
+ _dup(): ColorAnimationStep;
106
+ }
107
+ /**
108
+ * Dim color animation step
109
+ *
110
+ * ![](./apiassets/dim_animation.gif)
111
+ *
112
+ * Animates color of element to the `dimColor` property of {@link FigureElement}
113
+ *
114
+ * @extends ColorAnimationStep
115
+ * @param {number | OBJ_ElementAnimationStep} durationOrOptions
116
+ *
117
+ * @see To test examples, append them to the
118
+ * <a href="#animation-boilerplate">boilerplate</a>
119
+ *
120
+ * @example
121
+ * // Simple dim
122
+ * p.animations.new()
123
+ * .dim(2)
124
+ * .start();
125
+ *
126
+ * @example
127
+ * // Dim using options object
128
+ * p.animations.new()
129
+ * .dim({ delay: 1, duration: 2 })
130
+ * .start();
131
+ *
132
+ * @example
133
+ * // Different ways to create a stand-alone step
134
+ * const step1 = p.animations.dim(2);
135
+ * const step2 = new Fig.Animation.DimAnimationStep({
136
+ * element: p,
137
+ * duration: 2,
138
+ * });
139
+ *
140
+ * p.animations.new()
141
+ * .then(step1)
142
+ * .undim(1)
143
+ * .then(step2)
144
+ * .start();
145
+ * @group Animation
146
+ */
147
+ export declare class DimAnimationStep extends ColorAnimationStep {
148
+ /**
149
+ * @hideconstructor
150
+ */
151
+ constructor(timeOrOptionsIn?: number | OBJ_ElementAnimationStep, ...args: Array<OBJ_ElementAnimationStep>);
152
+ }
153
+ export declare function dim(timeOrOptionsIn?: number | OBJ_OpacityAnimationStep, ...args: Array<OBJ_OpacityAnimationStep>): DimAnimationStep;
154
+ /**
155
+ * Undim color animation step
156
+ *
157
+ * ![](./apiassets/undim_animation.gif)
158
+ *
159
+ * Animates color of element to the `defaultColor` property of {@link FigureElement}
160
+ *
161
+ * @extends ColorAnimationStep
162
+ * @param {number | OBJ_ElementAnimationStep} durationOrOptions
163
+ *
164
+ * @see To test examples, append them to the
165
+ * <a href="#animation-boilerplate">boilerplate</a>
166
+ *
167
+ * @example
168
+ * // Simple undim
169
+ * p.dim();
170
+ * p.animations.new()
171
+ * .undim(2)
172
+ * .start();
173
+ *
174
+ * @example
175
+ * // Undim using options object
176
+ * p.dim();
177
+ * p.animations.new()
178
+ * .undim({ delay: 1, duration: 2 })
179
+ * .start();
180
+ *
181
+ * @example
182
+ * // Different ways to create a stand-alone step
183
+ * const step1 = p.animations.undim(2);
184
+ * const step2 = new Fig.Animation.UndimAnimationStep({
185
+ * element: p,
186
+ * duration: 2,
187
+ * });
188
+ *
189
+ * p.dim();
190
+ * p.animations.new()
191
+ * .then(step1)
192
+ * .dim(1)
193
+ * .then(step2)
194
+ * .start();
195
+ * @group Animation
196
+ */
197
+ export declare class UndimAnimationStep extends ColorAnimationStep {
198
+ /**
199
+ * @hideconstructor
200
+ */
201
+ constructor(timeOrOptionsIn?: number | OBJ_ElementAnimationStep, ...args: Array<OBJ_ElementAnimationStep>);
202
+ }
203
+ export declare function undim(timeOrOptionsIn?: number | OBJ_OpacityAnimationStep, ...args: Array<OBJ_OpacityAnimationStep>): UndimAnimationStep;
@@ -0,0 +1,220 @@
1
+ import type { OBJ_ElementAnimationStep } from '../ElementAnimationStep';
2
+ import ElementAnimationStep from '../ElementAnimationStep';
3
+ import type { AnimationStartTime } from '../../AnimationManager';
4
+ /**
5
+ * {@link OpacityAnimationStep} options object
6
+ *
7
+ * @extends OBJ_ElementAnimationStep
8
+ *
9
+ * @property {number} [start]
10
+ * @property {number} [target]
11
+ * @property {number} [delta]
12
+ * @property {null | 'in' | 'out'} dissolve will override target opacity if not
13
+ * `null` (`null`)
14
+ * @property {boolean} dissolveFromCurrent (`false`)
15
+ * @interface
16
+ * @group Misc Animation
17
+ */
18
+ export type OBJ_OpacityAnimationStep = {
19
+ start?: number;
20
+ target?: number;
21
+ delta?: number;
22
+ dissolve?: 'in' | 'out' | null;
23
+ dissolveFromCurrent?: boolean;
24
+ } & OBJ_ElementAnimationStep;
25
+ /**
26
+ * Opacity Animation Step
27
+ *
28
+ * ![](./apiassets/opacity_animation.gif)
29
+ *
30
+ * A {@link FigureElement} has `color` and `opacity` properties. The `color`
31
+ * property has an alpha channel that defines opacity, but it should be used
32
+ * as a base color definition, and not used to dissolve an element in and out.
33
+ *
34
+ * Therefore, to animate an element's opacity or temporarily dissolve in or out
35
+ * an element, use an opacity animation step.
36
+ *
37
+ * The `opacity` is multiplied by the
38
+ * `color` alpha channel to get the final opacity of the element.
39
+ *
40
+ * By default, the opacity will start with the {@link FigureElement}'s current
41
+ * opacity unless dissolving. If dissolving, the opacity will start at `0` if
42
+ * dissolving in, or `1` if dissolving out unless `dissolveFromCurrent` is
43
+ * `true` in which case the opacity will start from the current opacity.
44
+ *
45
+ * The {@link DissolveInAnimationStep} and {@link DissolveOutAnimationStep}
46
+ * extend the `OpacityAnimationStep` to make it even more convenient to
47
+ * dissolve.
48
+ *
49
+ * @extends ElementAnimationStep
50
+ * @param {OBJ_OpacityAnimationStep} options
51
+ *
52
+ * @see To test examples, append them to the
53
+ * <a href="#animation-boilerplate">boilerplate</a>
54
+ *
55
+ * @example
56
+ * // Using numerical values for opacity
57
+ * p.animations.new()
58
+ * .opacity({ target: 0.4, duration: 2 })
59
+ * .opacity({ target: 1, duration: 2 })
60
+ * .start();
61
+ *
62
+ * @example
63
+ * // Dissolve out then in
64
+ * p.animations.new()
65
+ * .opacity({ dissolve: 'out', duration: 2 })
66
+ * .opacity({ dissolve: 'in', duration: 2 })
67
+ * .start();
68
+ *
69
+ * @example
70
+ * // Using the dissolve animation step
71
+ * p.animations.new()
72
+ * .dissolveOut(2)
73
+ * .dissolveIn({ delay: 1, duration: 2 })
74
+ * .start();
75
+ *
76
+ * @example
77
+ * // Different ways to create a stand-alone step
78
+ * const step1 = p.animations.opacity({
79
+ * target: 0,
80
+ * duration: 2,
81
+ * });
82
+ * const step2 = new Fig.Animation.OpacityAnimationStep({
83
+ * element: p,
84
+ * target: 1,
85
+ * duration: 2,
86
+ * });
87
+ * const step3 = p.animations.dissolveOut({
88
+ * duration: 2,
89
+ * });
90
+ * const step4 = new Fig.Animation.DissolveInAnimationStep({
91
+ * element: p,
92
+ * duration: 2,
93
+ * });
94
+ *
95
+ * p.animations.new()
96
+ * .then(step1)
97
+ * .then(step2)
98
+ * .then(step3)
99
+ * .then(step4)
100
+ * .start();
101
+ * @group Animation
102
+ */
103
+ export declare class OpacityAnimationStep extends ElementAnimationStep {
104
+ opacity: {
105
+ start: number;
106
+ delta: number;
107
+ target: number;
108
+ whenComplete: number;
109
+ dissolve?: 'in' | 'out' | null;
110
+ dissolveFromCurrent: boolean;
111
+ };
112
+ /**
113
+ * @hideconstructor
114
+ */
115
+ constructor(...optionsIn: Array<OBJ_OpacityAnimationStep>);
116
+ _getStateProperties(): string[];
117
+ _getStateName(): string;
118
+ start(startTime?: AnimationStartTime | null): void;
119
+ cancelledWithNoComplete(): void;
120
+ setFrame(deltaTime: number): void;
121
+ setToEnd(): void;
122
+ _dup(): OpacityAnimationStep;
123
+ }
124
+ /**
125
+ * Dissolve in animation step
126
+ *
127
+ * ![](./apiassets/dissolvein_animation.gif)
128
+ *
129
+ * Animates opacity of element to dissolve in.
130
+ *
131
+ * @extends OpacityAnimationStep
132
+ * @param {number | OBJ_ElementAnimationStep} durationOrOptions
133
+ *
134
+ * @see To test examples, append them to the
135
+ * <a href="#animation-boilerplate">boilerplate</a>
136
+ *
137
+ * @example
138
+ * // Simple dissolve in
139
+ * p.setOpacity(0)
140
+ * p.animations.new()
141
+ * .dissolveIn(2)
142
+ * .start();
143
+ *
144
+ * @example
145
+ * // Dissolve in using options object
146
+ * p.setOpacity(0);
147
+ * p.animations.new()
148
+ * .dissolveIn({ delay: 1, duration: 2 })
149
+ * .start();
150
+ *
151
+ * @example
152
+ * // Different ways to create a stand-alone step
153
+ * const step1 = p.animations.dissolveIn(2);
154
+ * const step2 = new Fig.Animation.DissolveInAnimationStep({
155
+ * element: p,
156
+ * duration: 2,
157
+ * });
158
+ *
159
+ * p.setOpacity(0);
160
+ * p.animations.new()
161
+ * .then(step1)
162
+ * .dissolveOut(1)
163
+ * .then(step2)
164
+ * .start();
165
+ * @group Animation
166
+ */
167
+ export declare class DissolveInAnimationStep extends OpacityAnimationStep {
168
+ /**
169
+ * @hideconstructor
170
+ */
171
+ constructor(timeOrOptionsIn?: number | OBJ_ElementAnimationStep, ...args: Array<OBJ_ElementAnimationStep>);
172
+ }
173
+ export declare function dissolveIn(timeOrOptionsIn?: number | OBJ_OpacityAnimationStep, ...args: Array<OBJ_OpacityAnimationStep>): DissolveInAnimationStep;
174
+ /**
175
+ * Dissolve out animation step
176
+ *
177
+ * ![](./apiassets/dissolveout_animation.gif)
178
+ *
179
+ * Animates opacity of element to dissolve out.
180
+ *
181
+ * @extends OpacityAnimationStep
182
+ * @param {number | OBJ_ElementAnimationStep} durationOrOptions
183
+ *
184
+ * @see To test examples, append them to the
185
+ * <a href="#animation-boilerplate">boilerplate</a>
186
+ *
187
+ * @example
188
+ * // Simple dissolve out
189
+ * p.animations.new()
190
+ * .dissolveOut(2)
191
+ * .start();
192
+ *
193
+ * @example
194
+ * // Dissolve out using options object
195
+ * p.animations.new()
196
+ * .dissolveOut({ delay: 1, duration: 2 })
197
+ * .start();
198
+ *
199
+ * @example
200
+ * // Different ways to create a stand-alone step
201
+ * const step1 = p.animations.dissolveOut(2);
202
+ * const step2 = new Fig.Animation.DissolveOutAnimationStep({
203
+ * element: p,
204
+ * duration: 2,
205
+ * });
206
+ *
207
+ * p.animations.new()
208
+ * .then(step1)
209
+ * .dissolveIn(1)
210
+ * .then(step2)
211
+ * .start();
212
+ * @group Animation
213
+ */
214
+ export declare class DissolveOutAnimationStep extends OpacityAnimationStep {
215
+ /**
216
+ * @hideconstructor
217
+ */
218
+ constructor(timeOrOptionsIn?: number | OBJ_ElementAnimationStep, ...args: Array<OBJ_ElementAnimationStep>);
219
+ }
220
+ export declare function dissolveOut(timeOrOptionsIn?: number | OBJ_OpacityAnimationStep, ...args: Array<OBJ_OpacityAnimationStep>): DissolveOutAnimationStep;
@@ -0,0 +1,124 @@
1
+ import { Point } from '../../../../tools/g2';
2
+ import type { OBJ_TranslationPath } from '../../../../tools/g2';
3
+ import type { OBJ_ElementAnimationStep } from '../ElementAnimationStep';
4
+ import ElementAnimationStep from '../ElementAnimationStep';
5
+ import type { AnimationStartTime } from '../../AnimationManager';
6
+ /**
7
+ * {@link PositionAnimationStep} options object
8
+ *
9
+ * @extends OBJ_ElementAnimationStep
10
+ *
11
+ * @property {TypeParsablePoint} [start] start position - if undefined then
12
+ * current position is used
13
+ * @property {TypeParsablePoint} [target] target position - if undefined then
14
+ * `delta` is used
15
+ * @property {TypeParsablePoint} [delta] target delta - only used if `target`
16
+ * is undefined
17
+ * @property {null | TypeParsablePoint | number} [velocity] velocity of
18
+ * position overrides `duration` - `null` to use `duration` (`null`)
19
+ * @property {number} [null | maxDuration] maximum duration to cap to -
20
+ * `null` for no cap (`null`)
21
+ * @property {OBJ_TranslationPath} [path] (`{ style: 'linear' }`)
22
+ * @property {number | null} [maxDuration] maximum duration to clip animation
23
+ * to where `null` is unlimited (`null`)
24
+ *
25
+ * @see {@link PositionAnimationStep} for description and examples
26
+ * @interface
27
+ * @group Misc Animation
28
+ */
29
+ export type OBJ_PositionAnimationStep = {
30
+ start?: Point;
31
+ target?: Point;
32
+ delta?: Point;
33
+ path?: OBJ_TranslationPath;
34
+ velocity?: Point;
35
+ maxDuration?: number;
36
+ } & OBJ_ElementAnimationStep;
37
+ /**
38
+ * Position animation step
39
+ *
40
+ * ![](./apiassets/position_animation.gif)
41
+ *
42
+ * The position animation step animates the first {@link Translation} transform
43
+ * in the {@link FigureElement}'s {@link Transform}.
44
+ *
45
+ * By default, the position will start with the element's current position.
46
+ *
47
+ * Use either `delta` or `target` to define it's end point.
48
+ *
49
+ * The path of travel between `start` and `target` can either be a straight
50
+ * line (`'linear'`) or a quadratic bezier curve (`'curve'`)
51
+ *
52
+ * For custom paths, the {@link CustomAnimationStep} can be used.
53
+ *
54
+ *
55
+ * @extends ElementAnimationStep
56
+ *
57
+ * @param {OBJ_PositionAnimationStep} options
58
+ *
59
+ * @see To test examples, append them to the
60
+ * <a href="#animation-boilerplate">boilerplate</a>
61
+ *
62
+ * @example
63
+ * // Using duration
64
+ * p.animations.new()
65
+ * .position({ target: [1, 0], duration: 2 })
66
+ * .start()
67
+ *
68
+ * @example
69
+ * // Using velocity
70
+ * p.animations.new()
71
+ * .position({ target: [1, 0], velocity: 0.5 })
72
+ * .start()
73
+ *
74
+ * @example
75
+ * // Linear and curved path
76
+ * p.animations.new()
77
+ * .delay(1)
78
+ * .position({ target: [1, 0], duration: 2 })
79
+ * .position({
80
+ * target: [0, 0],
81
+ * duration: 2,
82
+ * path: {
83
+ * style: 'curve',
84
+ * magnitude: 0.8,
85
+ * direction: 'up',
86
+ * },
87
+ * })
88
+ * .start();
89
+ *
90
+ * @example
91
+ * // Different ways to create a stand-alone step
92
+ * const step1 = p.animations.position({ target: [1, 0], duration: 2 });
93
+ * const step2 = new Fig.Animation.PositionAnimationStep({
94
+ * element: p,
95
+ * target: [0, 0],
96
+ * duration: 2,
97
+ * });
98
+ *
99
+ * p.animations.new()
100
+ * .then(step1)
101
+ * .then(step2)
102
+ * .start();
103
+ * @group Animation
104
+ */
105
+ export default class PositionAnimationStep extends ElementAnimationStep {
106
+ position: {
107
+ start: Point | null | undefined;
108
+ delta: Point | null | undefined;
109
+ target: Point | null | undefined;
110
+ path: OBJ_TranslationPath;
111
+ velocity: Point | null | undefined;
112
+ maxDuration: number | null | undefined;
113
+ };
114
+ /**
115
+ * @hideconstructor
116
+ */
117
+ constructor(...optionsIn: Array<OBJ_PositionAnimationStep>);
118
+ _getStateProperties(): string[];
119
+ _getStateName(): string;
120
+ start(startTime?: AnimationStartTime | null): void;
121
+ setFrame(deltaTime: number): void;
122
+ setToEnd(): void;
123
+ _dup(): PositionAnimationStep;
124
+ }
@@ -0,0 +1,137 @@
1
+ import type { TypeParsablePoint } from '../../../../tools/g2';
2
+ import type { OBJ_ElementAnimationStep } from '../ElementAnimationStep';
3
+ import ElementAnimationStep from '../ElementAnimationStep';
4
+ import type { TypeWhen } from '../../../TimeKeeper';
5
+ import type { FigureElement } from '../../../Element';
6
+ /**
7
+ * {@link PulseAnimationStep} options object
8
+ *
9
+ * @extends OBJ_ElementAnimationStep
10
+ * @property {number} [frequency] pulse frequency in Hz - a frequency of zero
11
+ * will set the frequency so just one cycle will be performed in the duration
12
+ * (`0`)
13
+ * @property {number} [scale] maximum scale value to pulse to (`1.5`)
14
+ * @property {number} [rotation] maximum rotation value to pulse to
15
+ * @property {number} [translation] maximum translation displacment value to
16
+ * pulse to (`1.5`)
17
+ * @property {number} [angle] translation angle (`0`)
18
+ * @property {number} [min] minimum value to pulse to
19
+ * @property {null | FigureElement | TypeParsablePoint} [centerOn] center
20
+ * of scale or rotation pulse. By default, the element calling the pulse
21
+ * will be the default `centerOn`.
22
+ * @property {'left' | 'center' | 'right' | 'location' | number} [xAlign]
23
+ * if `centerOn` is a {@link FigureElement} then this property can be used to
24
+ * horizontally align the pulse center with the element. `'location'` is the
25
+ * (0, 0) draw space coordinate of the element. `number` defines the percent
26
+ * width from the left of the element (`'center'`)
27
+ * @property {'bottom' | 'middle' | 'top' | 'location' | number} [yAlign]
28
+ * if `centerOn` is a {@link FigureElement} then this property can be used to
29
+ * vertically align the pulse center with the element. `'location'` is the
30
+ * (0, 0) draw space coordinate of the element. `number` defines the percent
31
+ * width from the left of the element (`'center'`)
32
+ * @property {'figure' | 'gl' | 'local' | 'draw' | 'pixel'} [space]
33
+ * if `centerOn` is a point, use this to define the space the point is in
34
+ * (`'figure'`)
35
+ * @property {number} [num] the number of draw copies of the pulse to make (`1`)
36
+ * @property {null | string | function(): void} [done] callback when pulse is
37
+ * finished. If `string` then the element's {@link FunctionMap} `fnMap` will be
38
+ * used (`null`)
39
+ * @property {TypeWhen} [when] when to start the pulse (`'syncNow'`)
40
+ *
41
+ * @interface
42
+ * @group Misc Animation
43
+ */
44
+ export type OBJ_PulseAnimationStep = {
45
+ stopAfterDuration?: boolean | null | undefined;
46
+ frequency?: number;
47
+ scale?: number;
48
+ rotation?: number;
49
+ translation?: number;
50
+ angle?: number;
51
+ min?: number;
52
+ centerOn?: null | FigureElement | TypeParsablePoint;
53
+ xAlign?: 'left' | 'center' | 'right' | 'origin' | number;
54
+ yAlign?: 'bottom' | 'middle' | 'top' | 'origin' | number;
55
+ space?: 'figure' | 'gl' | 'local' | 'draw';
56
+ done?: ((arg: any) => void) | null | undefined;
57
+ num?: number;
58
+ when?: TypeWhen;
59
+ } & OBJ_ElementAnimationStep;
60
+ /**
61
+ * Pulse animation step
62
+ *
63
+ * ![](./apiassets/pulse_animation.gif)
64
+ *
65
+ * The pulse animation step animates a pulse.
66
+ *
67
+ * The options are the same as those in the * <a href="#figureelementpulse">pulse</a> method.
68
+ *
69
+ * @extends ElementAnimationStep
70
+ * @param {OBJ_PulseAnimationStep} options
71
+ *
72
+ *
73
+ * @see To test examples, append them to the
74
+ * <a href="#animation-boilerplate">boilerplate</a>
75
+ *
76
+ * @example
77
+ * // Scale pulse, rotation pulse and translation pulse
78
+ * p.animations.new()
79
+ * .pulse({
80
+ * scale: 1.5,
81
+ * duration: 1,
82
+ * })
83
+ * .pulse({
84
+ * duration: 1,
85
+ * rotation: 0.15,
86
+ * frequency: 4,
87
+ * })
88
+ * .pulse({
89
+ * duration: 1,
90
+ * translation: 0.02,
91
+ * min: -0.02,
92
+ * frequency: 4,
93
+ * })
94
+ * .start();
95
+ *
96
+ * @example
97
+ * // Different ways to create a stand-alone step
98
+ * const step1 = p.animations.pulse({
99
+ * scale: 1.5,
100
+ * duration: 1,
101
+ * });
102
+ * const step2 = new Fig.Animation.PulseAnimationStep({
103
+ * element: p,
104
+ * rotation: 0.15,
105
+ * frequency: 4,
106
+ * });
107
+ * p.animations.new()
108
+ * .then(step1)
109
+ * .then(step2)
110
+ * .start();
111
+ * @group Animation
112
+ */
113
+ export default class PulseAnimationStep extends ElementAnimationStep {
114
+ pulse: {
115
+ frequency: number;
116
+ scale: number;
117
+ rotation?: number;
118
+ translation?: number;
119
+ angle: number;
120
+ min: number;
121
+ centerOn: null | FigureElement | TypeParsablePoint;
122
+ xAlign: 'left' | 'center' | 'right' | 'origin' | number;
123
+ yAlign: 'bottom' | 'middle' | 'top' | 'origin' | number;
124
+ space: 'figure' | 'gl' | 'local' | 'draw';
125
+ done: ((arg: any) => void) | null | undefined;
126
+ num: number;
127
+ when: TypeWhen;
128
+ stopAfterDuration: boolean;
129
+ };
130
+ toStart: boolean;
131
+ constructor(...optionsIn: Array<OBJ_PulseAnimationStep>);
132
+ _getStateProperties(): string[];
133
+ _getStateName(): string;
134
+ setFrame(): void;
135
+ setToEnd(): void;
136
+ _dup(): PulseAnimationStep;
137
+ }