@twick/core 0.11.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/LICENSE +21 -0
- package/lib/app/Logger.d.ts +105 -0
- package/lib/app/Logger.d.ts.map +1 -0
- package/lib/app/Logger.js +77 -0
- package/lib/app/PlaybackManager.d.ts +55 -0
- package/lib/app/PlaybackManager.d.ts.map +1 -0
- package/lib/app/PlaybackManager.js +179 -0
- package/lib/app/PlaybackStatus.d.ts +30 -0
- package/lib/app/PlaybackStatus.d.ts.map +1 -0
- package/lib/app/PlaybackStatus.js +46 -0
- package/lib/app/Player.d.ts +130 -0
- package/lib/app/Player.d.ts.map +1 -0
- package/lib/app/Player.js +375 -0
- package/lib/app/Project.d.ts +145 -0
- package/lib/app/Project.d.ts.map +1 -0
- package/lib/app/Project.js +10 -0
- package/lib/app/Renderer.d.ts +90 -0
- package/lib/app/Renderer.d.ts.map +1 -0
- package/lib/app/Renderer.js +318 -0
- package/lib/app/SharedWebGLContext.d.ts +24 -0
- package/lib/app/SharedWebGLContext.d.ts.map +1 -0
- package/lib/app/SharedWebGLContext.js +200 -0
- package/lib/app/Stage.d.ts +30 -0
- package/lib/app/Stage.d.ts.map +1 -0
- package/lib/app/Stage.js +75 -0
- package/lib/app/TimeEstimator.d.ts +53 -0
- package/lib/app/TimeEstimator.d.ts.map +1 -0
- package/lib/app/TimeEstimator.js +70 -0
- package/lib/app/index.d.ts +16 -0
- package/lib/app/index.d.ts.map +1 -0
- package/lib/app/index.js +16 -0
- package/lib/app/makeProject.d.ts +15 -0
- package/lib/app/makeProject.d.ts.map +1 -0
- package/lib/app/makeProject.js +72 -0
- package/lib/app/project-settings.d.ts +8 -0
- package/lib/app/project-settings.d.ts.map +1 -0
- package/lib/app/project-settings.js +13 -0
- package/lib/decorators/decorate.d.ts +2 -0
- package/lib/decorators/decorate.d.ts.map +1 -0
- package/lib/decorators/decorate.js +10 -0
- package/lib/decorators/deprecated.d.ts +5 -0
- package/lib/decorators/deprecated.d.ts.map +1 -0
- package/lib/decorators/deprecated.js +23 -0
- package/lib/decorators/index.d.ts +9 -0
- package/lib/decorators/index.d.ts.map +1 -0
- package/lib/decorators/index.js +9 -0
- package/lib/decorators/lazy.d.ts +14 -0
- package/lib/decorators/lazy.d.ts.map +1 -0
- package/lib/decorators/lazy.js +27 -0
- package/lib/decorators/threadable.d.ts +2 -0
- package/lib/decorators/threadable.d.ts.map +1 -0
- package/lib/decorators/threadable.js +7 -0
- package/lib/events/AsyncEventDispatcher.d.ts +45 -0
- package/lib/events/AsyncEventDispatcher.d.ts.map +1 -0
- package/lib/events/AsyncEventDispatcher.js +33 -0
- package/lib/events/EventDispatcher.d.ts +38 -0
- package/lib/events/EventDispatcher.d.ts.map +1 -0
- package/lib/events/EventDispatcher.js +29 -0
- package/lib/events/EventDispatcherBase.d.ts +55 -0
- package/lib/events/EventDispatcherBase.d.ts.map +1 -0
- package/lib/events/EventDispatcherBase.js +68 -0
- package/lib/events/FlagDispatcher.d.ts +54 -0
- package/lib/events/FlagDispatcher.d.ts.map +1 -0
- package/lib/events/FlagDispatcher.js +63 -0
- package/lib/events/ValueDispatcher.d.ts +81 -0
- package/lib/events/ValueDispatcher.d.ts.map +1 -0
- package/lib/events/ValueDispatcher.js +97 -0
- package/lib/events/index.d.ts +11 -0
- package/lib/events/index.d.ts.map +1 -0
- package/lib/events/index.js +11 -0
- package/lib/exporter/Exporter.d.ts +101 -0
- package/lib/exporter/Exporter.d.ts.map +1 -0
- package/lib/exporter/Exporter.js +2 -0
- package/lib/exporter/FFmpegExporter.d.ts +50 -0
- package/lib/exporter/FFmpegExporter.d.ts.map +1 -0
- package/lib/exporter/FFmpegExporter.js +140 -0
- package/lib/exporter/ImageExporter.d.ts +34 -0
- package/lib/exporter/ImageExporter.d.ts.map +1 -0
- package/lib/exporter/ImageExporter.js +80 -0
- package/lib/exporter/WasmExporter.d.ts +19 -0
- package/lib/exporter/WasmExporter.d.ts.map +1 -0
- package/lib/exporter/WasmExporter.js +78 -0
- package/lib/exporter/download-videos.d.ts +3 -0
- package/lib/exporter/download-videos.d.ts.map +1 -0
- package/lib/exporter/download-videos.js +45 -0
- package/lib/exporter/index.d.ts +5 -0
- package/lib/exporter/index.d.ts.map +1 -0
- package/lib/exporter/index.js +5 -0
- package/lib/flow/all.d.ts +18 -0
- package/lib/flow/all.d.ts.map +1 -0
- package/lib/flow/all.js +25 -0
- package/lib/flow/any.d.ts +18 -0
- package/lib/flow/any.d.ts.map +1 -0
- package/lib/flow/any.js +25 -0
- package/lib/flow/chain.d.ts +36 -0
- package/lib/flow/chain.d.ts.map +1 -0
- package/lib/flow/chain.js +46 -0
- package/lib/flow/delay.d.ts +29 -0
- package/lib/flow/delay.d.ts.map +1 -0
- package/lib/flow/delay.js +39 -0
- package/lib/flow/every.d.ts +41 -0
- package/lib/flow/every.d.ts.map +1 -0
- package/lib/flow/every.js +61 -0
- package/lib/flow/index.d.ts +17 -0
- package/lib/flow/index.d.ts.map +1 -0
- package/lib/flow/index.js +17 -0
- package/lib/flow/join.d.ts +35 -0
- package/lib/flow/join.d.ts.map +1 -0
- package/lib/flow/join.js +33 -0
- package/lib/flow/loop.d.ts +58 -0
- package/lib/flow/loop.d.ts.map +1 -0
- package/lib/flow/loop.js +51 -0
- package/lib/flow/loopFor.d.ts +25 -0
- package/lib/flow/loopFor.d.ts.map +1 -0
- package/lib/flow/loopFor.js +42 -0
- package/lib/flow/names.d.ts +3 -0
- package/lib/flow/names.d.ts.map +1 -0
- package/lib/flow/names.js +11 -0
- package/lib/flow/run.d.ts +45 -0
- package/lib/flow/run.d.ts.map +1 -0
- package/lib/flow/run.js +14 -0
- package/lib/flow/scheduling.d.ts +18 -0
- package/lib/flow/scheduling.d.ts.map +1 -0
- package/lib/flow/scheduling.js +33 -0
- package/lib/flow/sequence.d.ts +22 -0
- package/lib/flow/sequence.d.ts.map +1 -0
- package/lib/flow/sequence.js +31 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/media/index.d.ts +7 -0
- package/lib/media/index.d.ts.map +1 -0
- package/lib/media/index.js +7 -0
- package/lib/media/loadImage.d.ts +8 -0
- package/lib/media/loadImage.d.ts.map +1 -0
- package/lib/media/loadImage.js +29 -0
- package/lib/plugin/DefaultPlugin.d.ts +10 -0
- package/lib/plugin/DefaultPlugin.d.ts.map +1 -0
- package/lib/plugin/DefaultPlugin.js +17 -0
- package/lib/plugin/Plugin.d.ts +53 -0
- package/lib/plugin/Plugin.d.ts.map +1 -0
- package/lib/plugin/Plugin.js +2 -0
- package/lib/plugin/index.d.ts +3 -0
- package/lib/plugin/index.d.ts.map +1 -0
- package/lib/plugin/index.js +3 -0
- package/lib/plugin/makePlugin.d.ts +15 -0
- package/lib/plugin/makePlugin.d.ts.map +1 -0
- package/lib/plugin/makePlugin.js +16 -0
- package/lib/scenes/GeneratorScene.d.ts +95 -0
- package/lib/scenes/GeneratorScene.d.ts.map +1 -0
- package/lib/scenes/GeneratorScene.js +273 -0
- package/lib/scenes/Inspectable.d.ts +71 -0
- package/lib/scenes/Inspectable.d.ts.map +1 -0
- package/lib/scenes/Inspectable.js +4 -0
- package/lib/scenes/LifecycleEvents.d.ts +18 -0
- package/lib/scenes/LifecycleEvents.d.ts.map +1 -0
- package/lib/scenes/LifecycleEvents.js +45 -0
- package/lib/scenes/Random.d.ts +66 -0
- package/lib/scenes/Random.d.ts.map +1 -0
- package/lib/scenes/Random.js +101 -0
- package/lib/scenes/Scene.d.ts +298 -0
- package/lib/scenes/Scene.d.ts.map +1 -0
- package/lib/scenes/Scene.js +25 -0
- package/lib/scenes/SceneState.d.ts +34 -0
- package/lib/scenes/SceneState.d.ts.map +1 -0
- package/lib/scenes/SceneState.js +35 -0
- package/lib/scenes/Shaders.d.ts +63 -0
- package/lib/scenes/Shaders.d.ts.map +1 -0
- package/lib/scenes/Shaders.js +158 -0
- package/lib/scenes/Slides.d.ts +33 -0
- package/lib/scenes/Slides.d.ts.map +1 -0
- package/lib/scenes/Slides.js +115 -0
- package/lib/scenes/Threadable.d.ts +19 -0
- package/lib/scenes/Threadable.d.ts.map +1 -0
- package/lib/scenes/Threadable.js +4 -0
- package/lib/scenes/Variables.d.ts +24 -0
- package/lib/scenes/Variables.d.ts.map +1 -0
- package/lib/scenes/Variables.js +39 -0
- package/lib/scenes/index.d.ts +16 -0
- package/lib/scenes/index.d.ts.map +1 -0
- package/lib/scenes/index.js +16 -0
- package/lib/signals/CompoundSignalContext.d.ts +21 -0
- package/lib/signals/CompoundSignalContext.d.ts.map +1 -0
- package/lib/signals/CompoundSignalContext.js +73 -0
- package/lib/signals/ComputedContext.d.ts +14 -0
- package/lib/signals/ComputedContext.d.ts.map +1 -0
- package/lib/signals/ComputedContext.js +36 -0
- package/lib/signals/DependencyContext.d.ts +32 -0
- package/lib/signals/DependencyContext.d.ts.map +1 -0
- package/lib/signals/DependencyContext.js +87 -0
- package/lib/signals/SignalContext.d.ts +120 -0
- package/lib/signals/SignalContext.d.ts.map +1 -0
- package/lib/signals/SignalContext.js +245 -0
- package/lib/signals/createComputed.d.ts +3 -0
- package/lib/signals/createComputed.d.ts.map +1 -0
- package/lib/signals/createComputed.js +5 -0
- package/lib/signals/createComputedAsync.d.ts +4 -0
- package/lib/signals/createComputedAsync.d.ts.map +1 -0
- package/lib/signals/createComputedAsync.js +15 -0
- package/lib/signals/createSignal.d.ts +5 -0
- package/lib/signals/createSignal.d.ts.map +1 -0
- package/lib/signals/createSignal.js +6 -0
- package/lib/signals/index.d.ts +16 -0
- package/lib/signals/index.d.ts.map +1 -0
- package/lib/signals/index.js +16 -0
- package/lib/signals/symbols.d.ts +2 -0
- package/lib/signals/symbols.d.ts.map +1 -0
- package/lib/signals/symbols.js +2 -0
- package/lib/signals/types.d.ts +51 -0
- package/lib/signals/types.d.ts.map +1 -0
- package/lib/signals/types.js +2 -0
- package/lib/signals/utils.d.ts +5 -0
- package/lib/signals/utils.d.ts.map +1 -0
- package/lib/signals/utils.js +10 -0
- package/lib/threading/Thread.d.ts +77 -0
- package/lib/threading/Thread.d.ts.map +1 -0
- package/lib/threading/Thread.js +169 -0
- package/lib/threading/ThreadGenerator.d.ts +39 -0
- package/lib/threading/ThreadGenerator.d.ts.map +1 -0
- package/lib/threading/ThreadGenerator.js +17 -0
- package/lib/threading/cancel.d.ts +17 -0
- package/lib/threading/cancel.d.ts.map +1 -0
- package/lib/threading/cancel.js +26 -0
- package/lib/threading/index.d.ts +11 -0
- package/lib/threading/index.d.ts.map +1 -0
- package/lib/threading/index.js +11 -0
- package/lib/threading/spawn.d.ts +28 -0
- package/lib/threading/spawn.d.ts.map +1 -0
- package/lib/threading/spawn.js +30 -0
- package/lib/threading/threads.d.ts +46 -0
- package/lib/threading/threads.d.ts.map +1 -0
- package/lib/threading/threads.js +89 -0
- package/lib/transitions/fadeTransition.d.ts +8 -0
- package/lib/transitions/fadeTransition.d.ts.map +1 -0
- package/lib/transitions/fadeTransition.js +16 -0
- package/lib/transitions/index.d.ts +11 -0
- package/lib/transitions/index.d.ts.map +1 -0
- package/lib/transitions/index.js +11 -0
- package/lib/transitions/slideTransition.d.ts +18 -0
- package/lib/transitions/slideTransition.d.ts.map +1 -0
- package/lib/transitions/slideTransition.js +14 -0
- package/lib/transitions/useTransition.d.ts +10 -0
- package/lib/transitions/useTransition.d.ts.map +1 -0
- package/lib/transitions/useTransition.js +27 -0
- package/lib/transitions/zoomInTransition.d.ts +10 -0
- package/lib/transitions/zoomInTransition.d.ts.map +1 -0
- package/lib/transitions/zoomInTransition.js +33 -0
- package/lib/transitions/zoomOutTransition.d.ts +10 -0
- package/lib/transitions/zoomOutTransition.d.ts.map +1 -0
- package/lib/transitions/zoomOutTransition.js +33 -0
- package/lib/tsconfig.build.tsbuildinfo +1 -0
- package/lib/tweening/helpers.d.ts +5 -0
- package/lib/tweening/helpers.d.ts.map +1 -0
- package/lib/tweening/helpers.js +16 -0
- package/lib/tweening/index.d.ts +11 -0
- package/lib/tweening/index.d.ts.map +1 -0
- package/lib/tweening/index.js +11 -0
- package/lib/tweening/interpolationFunctions.d.ts +38 -0
- package/lib/tweening/interpolationFunctions.d.ts.map +1 -0
- package/lib/tweening/interpolationFunctions.js +107 -0
- package/lib/tweening/spring.d.ts +20 -0
- package/lib/tweening/spring.d.ts.map +1 -0
- package/lib/tweening/spring.js +103 -0
- package/lib/tweening/timingFunctions.d.ts +46 -0
- package/lib/tweening/timingFunctions.d.ts.map +1 -0
- package/lib/tweening/timingFunctions.js +233 -0
- package/lib/tweening/tween.d.ts +3 -0
- package/lib/tweening/tween.d.ts.map +1 -0
- package/lib/tweening/tween.js +21 -0
- package/lib/types/BBox.d.ts +73 -0
- package/lib/types/BBox.d.ts.map +1 -0
- package/lib/types/BBox.js +249 -0
- package/lib/types/Canvas.d.ts +3 -0
- package/lib/types/Canvas.d.ts.map +1 -0
- package/lib/types/Canvas.js +2 -0
- package/lib/types/Color.d.ts +65 -0
- package/lib/types/Color.d.ts.map +1 -0
- package/lib/types/Color.js +185 -0
- package/lib/types/Matrix.d.ts +3 -0
- package/lib/types/Matrix.d.ts.map +1 -0
- package/lib/types/Matrix.js +10 -0
- package/lib/types/Matrix2D.d.ts +363 -0
- package/lib/types/Matrix2D.d.ts.map +1 -0
- package/lib/types/Matrix2D.js +554 -0
- package/lib/types/Origin.d.ts +17 -0
- package/lib/types/Origin.d.ts.map +1 -0
- package/lib/types/Origin.js +53 -0
- package/lib/types/Spacing.d.ts +36 -0
- package/lib/types/Spacing.d.ts.map +1 -0
- package/lib/types/Spacing.js +70 -0
- package/lib/types/Type.d.ts +9 -0
- package/lib/types/Type.d.ts.map +1 -0
- package/lib/types/Type.js +5 -0
- package/lib/types/Vector.d.ts +203 -0
- package/lib/types/Vector.d.ts.map +1 -0
- package/lib/types/Vector.js +355 -0
- package/lib/types/alignment-enums.d.ts +22 -0
- package/lib/types/alignment-enums.d.ts.map +1 -0
- package/lib/types/alignment-enums.js +25 -0
- package/lib/types/index.d.ts +17 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +17 -0
- package/lib/types/vector-transformations.d.ts +20 -0
- package/lib/types/vector-transformations.d.ts.map +1 -0
- package/lib/types/vector-transformations.js +31 -0
- package/lib/utils/DetailedError.d.ts +24 -0
- package/lib/utils/DetailedError.d.ts.map +1 -0
- package/lib/utils/DetailedError.js +16 -0
- package/lib/utils/ExperimentalError.d.ts +10 -0
- package/lib/utils/ExperimentalError.d.ts.map +1 -0
- package/lib/utils/ExperimentalError.js +32 -0
- package/lib/utils/Semaphore.d.ts +12 -0
- package/lib/utils/Semaphore.d.ts.map +1 -0
- package/lib/utils/Semaphore.js +25 -0
- package/lib/utils/beginSlide.d.ts +3 -0
- package/lib/utils/beginSlide.d.ts.map +1 -0
- package/lib/utils/beginSlide.js +12 -0
- package/lib/utils/capitalize.d.ts +2 -0
- package/lib/utils/capitalize.d.ts.map +1 -0
- package/lib/utils/capitalize.js +4 -0
- package/lib/utils/createRef.d.ts +15 -0
- package/lib/utils/createRef.d.ts.map +1 -0
- package/lib/utils/createRef.js +21 -0
- package/lib/utils/createRefArray.d.ts +27 -0
- package/lib/utils/createRefArray.d.ts.map +1 -0
- package/lib/utils/createRefArray.js +49 -0
- package/lib/utils/createRefMap.d.ts +50 -0
- package/lib/utils/createRefMap.d.ts.map +1 -0
- package/lib/utils/createRefMap.js +77 -0
- package/lib/utils/debug.d.ts +24 -0
- package/lib/utils/debug.d.ts.map +1 -0
- package/lib/utils/debug.js +47 -0
- package/lib/utils/deprecate.d.ts +9 -0
- package/lib/utils/deprecate.d.ts.map +1 -0
- package/lib/utils/deprecate.js +15 -0
- package/lib/utils/errorToLog.d.ts +3 -0
- package/lib/utils/errorToLog.d.ts.map +1 -0
- package/lib/utils/errorToLog.js +8 -0
- package/lib/utils/experimentalLog.d.ts +3 -0
- package/lib/utils/experimentalLog.d.ts.map +1 -0
- package/lib/utils/experimentalLog.js +10 -0
- package/lib/utils/getContext.d.ts +2 -0
- package/lib/utils/getContext.d.ts.map +1 -0
- package/lib/utils/getContext.js +8 -0
- package/lib/utils/index.d.ts +26 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +26 -0
- package/lib/utils/math.d.ts +15 -0
- package/lib/utils/math.d.ts.map +1 -0
- package/lib/utils/math.js +15 -0
- package/lib/utils/range.d.ts +40 -0
- package/lib/utils/range.d.ts.map +1 -0
- package/lib/utils/range.js +18 -0
- package/lib/utils/useContext.d.ts +13 -0
- package/lib/utils/useContext.d.ts.map +1 -0
- package/lib/utils/useContext.js +18 -0
- package/lib/utils/usePlayback.d.ts +8 -0
- package/lib/utils/usePlayback.d.ts.map +1 -0
- package/lib/utils/usePlayback.js +20 -0
- package/lib/utils/useScene.d.ts +17 -0
- package/lib/utils/useScene.d.ts.map +1 -0
- package/lib/utils/useScene.js +33 -0
- package/lib/utils/useThread.d.ts +8 -0
- package/lib/utils/useThread.d.ts.map +1 -0
- package/lib/utils/useThread.js +24 -0
- package/lib/utils/useTime.d.ts +19 -0
- package/lib/utils/useTime.d.ts.map +1 -0
- package/lib/utils/useTime.js +22 -0
- package/package.json +36 -0
- package/project.d.ts +24 -0
- package/shaders/common.glsl +15 -0
- package/shaders/fragment.glsl +8 -0
- package/tsconfig.project.json +14 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import type { Type, WebGLConvertible } from './Type';
|
|
2
|
+
import type { PossibleVector2 } from './Vector';
|
|
3
|
+
import { Vector2 } from './Vector';
|
|
4
|
+
export type PossibleMatrix2D = Matrix2D | DOMMatrix | [number, number, number, number, number, number] | [PossibleVector2, PossibleVector2, PossibleVector2] | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* A specialized 2x3 Matrix representing a 2D transformation.
|
|
7
|
+
*
|
|
8
|
+
* A Matrix2D contains six elements defined as
|
|
9
|
+
* [a, b,
|
|
10
|
+
* c, d,
|
|
11
|
+
* tx, ty]
|
|
12
|
+
*
|
|
13
|
+
* This is a shortcut for a 3x3 matrix of the form
|
|
14
|
+
* [a, b, 0,
|
|
15
|
+
* c, d, 0
|
|
16
|
+
* tx, ty, 1]
|
|
17
|
+
*
|
|
18
|
+
* Note that because a Matrix2D ignores the z-values of each component vectors,
|
|
19
|
+
* it does not satisfy all properties of a "real" 3x3 matrix.
|
|
20
|
+
*
|
|
21
|
+
* - A Matrix2D has no transpose
|
|
22
|
+
* - A(B + C) = AB + AC does not hold for a Matrix2D
|
|
23
|
+
* - (rA)^-1 = r^-1 A^-1, r != 0 does not hold for a Matrix2D
|
|
24
|
+
* - r(AB) = (rA)B = A(rB) does not hold for a Matrix2D
|
|
25
|
+
*/
|
|
26
|
+
export declare class Matrix2D implements Type, WebGLConvertible {
|
|
27
|
+
static readonly symbol: unique symbol;
|
|
28
|
+
readonly values: Float32Array;
|
|
29
|
+
static readonly identity: Matrix2D;
|
|
30
|
+
static readonly zero: Matrix2D;
|
|
31
|
+
static fromRotation(angle: number): Matrix2D;
|
|
32
|
+
static fromTranslation(translation: PossibleVector2): Matrix2D;
|
|
33
|
+
static fromScaling(scale: PossibleVector2): Matrix2D;
|
|
34
|
+
get x(): Vector2;
|
|
35
|
+
get y(): Vector2;
|
|
36
|
+
get scaleX(): number;
|
|
37
|
+
set scaleX(value: number);
|
|
38
|
+
get skewX(): number;
|
|
39
|
+
set skewX(value: number);
|
|
40
|
+
get scaleY(): number;
|
|
41
|
+
set scaleY(value: number);
|
|
42
|
+
get skewY(): number;
|
|
43
|
+
set skewY(value: number);
|
|
44
|
+
get translateX(): number;
|
|
45
|
+
set translateX(value: number);
|
|
46
|
+
get translateY(): number;
|
|
47
|
+
set translateY(value: number);
|
|
48
|
+
get rotation(): number;
|
|
49
|
+
set rotation(angle: number);
|
|
50
|
+
get translation(): Vector2;
|
|
51
|
+
set translation(translation: PossibleVector2);
|
|
52
|
+
get scaling(): Vector2;
|
|
53
|
+
set scaling(value: PossibleVector2);
|
|
54
|
+
/**
|
|
55
|
+
* Get the inverse of the matrix.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* If the matrix is not invertible, i.e. its determinant is `0`, this will
|
|
59
|
+
* return `null`, instead.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const matrix = new Matrix2D(
|
|
64
|
+
* [1, 2],
|
|
65
|
+
* [3, 4],
|
|
66
|
+
* [5, 6],
|
|
67
|
+
* );
|
|
68
|
+
*
|
|
69
|
+
* const inverse = matrix.inverse;
|
|
70
|
+
* // => Matrix2D(
|
|
71
|
+
* // [-2, 1],
|
|
72
|
+
* // [1.5, -0.5],
|
|
73
|
+
* // [1, -2],
|
|
74
|
+
* // )
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
get inverse(): Matrix2D | null;
|
|
78
|
+
/**
|
|
79
|
+
* Get the determinant of the matrix.
|
|
80
|
+
*/
|
|
81
|
+
get determinant(): number;
|
|
82
|
+
get domMatrix(): DOMMatrix;
|
|
83
|
+
constructor();
|
|
84
|
+
constructor(matrix: PossibleMatrix2D);
|
|
85
|
+
constructor(x: PossibleVector2, y: PossibleVector2, z: PossibleVector2);
|
|
86
|
+
constructor(a: number, b: number, c: number, d: number, tx: number, ty: number);
|
|
87
|
+
/**
|
|
88
|
+
* Get the nth component vector of the matrix. Only defined for 0, 1, and 2.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const matrix = new Matrix2D(
|
|
93
|
+
* [1, 0],
|
|
94
|
+
* [0, 0],
|
|
95
|
+
* [1, 0],
|
|
96
|
+
* );
|
|
97
|
+
*
|
|
98
|
+
* const x = matrix.column(0);
|
|
99
|
+
* // Vector2(1, 0)
|
|
100
|
+
*
|
|
101
|
+
* const y = matrix.column(1);
|
|
102
|
+
* // Vector2(0, 0)
|
|
103
|
+
*
|
|
104
|
+
* const z = matrix.column(1);
|
|
105
|
+
* // Vector2(1, 0)
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @param index - The index of the component vector to retrieve.
|
|
109
|
+
*/
|
|
110
|
+
column(index: number): Vector2;
|
|
111
|
+
/**
|
|
112
|
+
* Returns the nth row of the matrix. Only defined for 0 and 1.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* const matrix = new Matrix2D(
|
|
117
|
+
* [1, 0],
|
|
118
|
+
* [0, 0],
|
|
119
|
+
* [1, 0],
|
|
120
|
+
* );
|
|
121
|
+
*
|
|
122
|
+
* const firstRow = matrix.column(0);
|
|
123
|
+
* // [1, 0, 1]
|
|
124
|
+
*
|
|
125
|
+
* const secondRow = matrix.column(1);
|
|
126
|
+
* // [0, 0, 0]
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* @param index - The index of the row to retrieve.
|
|
130
|
+
*/
|
|
131
|
+
row(index: number): [number, number, number];
|
|
132
|
+
/**
|
|
133
|
+
* Returns the matrix product of this matrix with the provided matrix.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* This method returns a new matrix representing the result of the
|
|
137
|
+
* computation. It will not modify the source matrix.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const a = new Matrix2D(
|
|
142
|
+
* [1, 2],
|
|
143
|
+
* [0, 1],
|
|
144
|
+
* [1, 1],
|
|
145
|
+
* );
|
|
146
|
+
* const b = new Matrix2D(
|
|
147
|
+
* [2, 1],
|
|
148
|
+
* [1, 1],
|
|
149
|
+
* [1, 1],
|
|
150
|
+
* );
|
|
151
|
+
*
|
|
152
|
+
* const result = a.mul(b);
|
|
153
|
+
* // => Matrix2D(
|
|
154
|
+
* // [2, 5],
|
|
155
|
+
* // [1, 3],
|
|
156
|
+
* // [2, 4],
|
|
157
|
+
* // )
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @param other - The matrix to multiply with
|
|
161
|
+
*/
|
|
162
|
+
mul(other: Matrix2D): Matrix2D;
|
|
163
|
+
/**
|
|
164
|
+
* Rotate the matrix by the provided angle. By default, the angle is
|
|
165
|
+
* provided in degrees.
|
|
166
|
+
*
|
|
167
|
+
* @remarks
|
|
168
|
+
* This method returns a new matrix representing the result of the
|
|
169
|
+
* computation. It will not modify the source matrix.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* const a = new Matrix2D(
|
|
174
|
+
* [1, 2],
|
|
175
|
+
* [3, 4],
|
|
176
|
+
* [5, 6],
|
|
177
|
+
* );
|
|
178
|
+
*
|
|
179
|
+
* const result = a.rotate(90);
|
|
180
|
+
* // => Matrix2D(
|
|
181
|
+
* // [3, 4],
|
|
182
|
+
* // [-1, -2],
|
|
183
|
+
* // [5, 6],
|
|
184
|
+
* // )
|
|
185
|
+
*
|
|
186
|
+
* // Provide the angle in radians
|
|
187
|
+
* const result = a.rotate(Math.PI * 0.5, true);
|
|
188
|
+
* // => Matrix2D(
|
|
189
|
+
* // [3, 4],
|
|
190
|
+
* // [-1, -2],
|
|
191
|
+
* // [5, 6],
|
|
192
|
+
* // )
|
|
193
|
+
* ```
|
|
194
|
+
*
|
|
195
|
+
* @param angle - The angle by which to rotate the matrix.
|
|
196
|
+
* @param degrees - Whether the angle is provided in degrees.
|
|
197
|
+
*/
|
|
198
|
+
rotate(angle: number, degrees?: boolean): Matrix2D;
|
|
199
|
+
/**
|
|
200
|
+
* Scale the x and y component vectors of the matrix.
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* If `vec` is provided as a vector, the x and y component vectors of the
|
|
204
|
+
* matrix will be scaled by the x and y parts of the vector, respectively.
|
|
205
|
+
*
|
|
206
|
+
* If `vec` is provided as a scalar, the x and y component vectors will be
|
|
207
|
+
* scaled uniformly by this factor.
|
|
208
|
+
*
|
|
209
|
+
* This method returns a new matrix representing the result of the
|
|
210
|
+
* computation. It will not modify the source matrix.
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* const matrix = new Matrix2D(
|
|
215
|
+
* [1, 2],
|
|
216
|
+
* [3, 4],
|
|
217
|
+
* [5, 6],
|
|
218
|
+
* );
|
|
219
|
+
*
|
|
220
|
+
* const result1 = matrix.scale([2, 3]);
|
|
221
|
+
* // => new Matrix2D(
|
|
222
|
+
* // [2, 4],
|
|
223
|
+
* // [9, 12],
|
|
224
|
+
* // [5, 6],
|
|
225
|
+
* // )
|
|
226
|
+
*
|
|
227
|
+
* const result2 = matrix.scale(2);
|
|
228
|
+
* // => new Matrix2D(
|
|
229
|
+
* // [2, 4],
|
|
230
|
+
* // [6, 8],
|
|
231
|
+
* // [5, 6],
|
|
232
|
+
* // )
|
|
233
|
+
* ```
|
|
234
|
+
*
|
|
235
|
+
* @param vec - The factor by which to scale the matrix
|
|
236
|
+
*/
|
|
237
|
+
scale(vec: PossibleVector2): Matrix2D;
|
|
238
|
+
/**
|
|
239
|
+
* Multiply each value of the matrix by a scalar.
|
|
240
|
+
*
|
|
241
|
+
* * @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* const matrix = new Matrix2D(
|
|
244
|
+
* [1, 2],
|
|
245
|
+
* [3, 4],
|
|
246
|
+
* [5, 6],
|
|
247
|
+
* );
|
|
248
|
+
*
|
|
249
|
+
* const result1 = matrix.mulScalar(2);
|
|
250
|
+
* // => new Matrix2D(
|
|
251
|
+
* // [2, 4],
|
|
252
|
+
* // [6, 8],
|
|
253
|
+
* // [10, 12],
|
|
254
|
+
* // )
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* @param s - The value by which to scale each term
|
|
258
|
+
*/
|
|
259
|
+
mulScalar(s: number): Matrix2D;
|
|
260
|
+
/**
|
|
261
|
+
* Translate the matrix by the dimensions of the provided vector.
|
|
262
|
+
*
|
|
263
|
+
* @remarks
|
|
264
|
+
* If `vec` is provided as a scalar, matrix will be translated uniformly
|
|
265
|
+
* by this factor.
|
|
266
|
+
*
|
|
267
|
+
* This method returns a new matrix representing the result of the
|
|
268
|
+
* computation. It will not modify the source matrix.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* const matrix = new Matrix2D(
|
|
273
|
+
* [1, 2],
|
|
274
|
+
* [3, 4],
|
|
275
|
+
* [5, 6],
|
|
276
|
+
* );
|
|
277
|
+
*
|
|
278
|
+
* const result1 = matrix.translate([2, 3]);
|
|
279
|
+
* // => new Matrix2D(
|
|
280
|
+
* // [1, 2],
|
|
281
|
+
* // [3, 4],
|
|
282
|
+
* // [16, 22],
|
|
283
|
+
* // )
|
|
284
|
+
*
|
|
285
|
+
* const result2 = matrix.translate(2);
|
|
286
|
+
* // => new Matrix2D(
|
|
287
|
+
* // [1, 2],
|
|
288
|
+
* // [3, 4],
|
|
289
|
+
* // [13, 18],
|
|
290
|
+
* // )
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* @param vec - The vector by which to translate the matrix
|
|
294
|
+
*/
|
|
295
|
+
translate(vec: PossibleVector2): Matrix2D;
|
|
296
|
+
/**
|
|
297
|
+
* Add the provided matrix to this matrix.
|
|
298
|
+
*
|
|
299
|
+
* @remarks
|
|
300
|
+
* This method returns a new matrix representing the result of the
|
|
301
|
+
* computation. It will not modify the source matrix.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* const a = new Matrix2D(
|
|
306
|
+
* [1, 2],
|
|
307
|
+
* [3, 4],
|
|
308
|
+
* [5, 6],
|
|
309
|
+
* );
|
|
310
|
+
* const a = new Matrix2D(
|
|
311
|
+
* [7, 8],
|
|
312
|
+
* [9, 10],
|
|
313
|
+
* [11, 12],
|
|
314
|
+
* );
|
|
315
|
+
*
|
|
316
|
+
* const result = a.add(b);
|
|
317
|
+
* // => Matrix2D(
|
|
318
|
+
* // [8, 10],
|
|
319
|
+
* // [12, 14],
|
|
320
|
+
* // [16, 18],
|
|
321
|
+
* // )
|
|
322
|
+
* ```
|
|
323
|
+
*
|
|
324
|
+
* @param other - The matrix to add
|
|
325
|
+
*/
|
|
326
|
+
add(other: Matrix2D): Matrix2D;
|
|
327
|
+
/**
|
|
328
|
+
* Subtract the provided matrix from this matrix.
|
|
329
|
+
*
|
|
330
|
+
* @remarks
|
|
331
|
+
* This method returns a new matrix representing the result of the
|
|
332
|
+
* computation. It will not modify the source matrix.
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```ts
|
|
336
|
+
* const a = new Matrix2D(
|
|
337
|
+
* [1, 2],
|
|
338
|
+
* [3, 4],
|
|
339
|
+
* [5, 6],
|
|
340
|
+
* );
|
|
341
|
+
* const a = new Matrix2D(
|
|
342
|
+
* [7, 8],
|
|
343
|
+
* [9, 10],
|
|
344
|
+
* [11, 12],
|
|
345
|
+
* );
|
|
346
|
+
*
|
|
347
|
+
* const result = a.sub(b);
|
|
348
|
+
* // => Matrix2D(
|
|
349
|
+
* // [-6, -6],
|
|
350
|
+
* // [-6, -6],
|
|
351
|
+
* // [-6, -6],
|
|
352
|
+
* // )
|
|
353
|
+
* ```
|
|
354
|
+
*
|
|
355
|
+
* @param other - The matrix to subract
|
|
356
|
+
*/
|
|
357
|
+
sub(other: Matrix2D): Matrix2D;
|
|
358
|
+
toSymbol(): symbol;
|
|
359
|
+
toUniform(gl: WebGL2RenderingContext, location: WebGLUniformLocation): void;
|
|
360
|
+
equals(other: Matrix2D, threshold?: number): boolean;
|
|
361
|
+
exactlyEquals(other: Matrix2D): boolean;
|
|
362
|
+
}
|
|
363
|
+
//# sourceMappingURL=Matrix2D.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Matrix2D.d.ts","sourceRoot":"","sources":["../../src/types/Matrix2D.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,IAAI,EAAE,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAEnD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,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