samcan 0.0.2 → 0.1.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 → LICENSE} +3 -1
- package/README.md +3 -0
- package/dist/camera/index.cjs +370 -0
- package/dist/camera/index.d.cts +54 -0
- package/dist/camera/index.d.ts +54 -0
- package/dist/camera/index.js +70 -0
- package/dist/document/index.cjs +735 -0
- package/dist/document/index.d.cts +174 -0
- package/dist/document/index.d.ts +174 -0
- package/dist/document/index.js +161 -0
- package/dist/editor/index.cjs +5007 -0
- package/dist/editor/index.d.cts +374 -0
- package/dist/editor/index.d.ts +374 -0
- package/dist/editor/index.js +2401 -0
- package/dist/engine/index.cjs +3752 -0
- package/dist/engine/index.d.cts +183 -0
- package/dist/engine/index.d.ts +183 -0
- package/dist/engine/index.js +111 -0
- package/dist/index.cjs +8899 -0
- package/dist/index.d.cts +962 -0
- package/dist/index.d.ts +962 -46
- package/dist/index.js +1008 -49
- package/dist/math/index.cjs +2230 -0
- package/dist/math/index.d.cts +302 -0
- package/dist/math/index.d.ts +302 -0
- package/dist/math/index.js +1109 -0
- package/dist/renderer/index.cjs +1865 -0
- package/dist/renderer/index.d.cts +91 -0
- package/dist/renderer/index.d.ts +91 -0
- package/dist/renderer/index.js +89 -0
- package/dist/shared/chunk-35pkr0zs.js +110 -0
- package/dist/shared/chunk-7sr7q84y.js +80 -0
- package/dist/shared/chunk-87399bz7.js +89 -0
- package/dist/shared/chunk-8ynnz57m.js +129 -0
- package/dist/shared/chunk-d6gxvapt.js +500 -0
- package/dist/shared/chunk-hewznwbd.js +305 -0
- package/dist/shared/chunk-jdvrd5tv.js +623 -0
- package/dist/shared/chunk-rvag1j46.js +461 -0
- package/dist/shared/chunk-rzxyjwk8.js +397 -0
- package/dist/shared/chunk-s3qdcmcq.js +1392 -0
- package/dist/shared/chunk-v53jprrn.js +68 -0
- package/dist/shared/chunk-wa3772hp.js +117 -0
- package/dist/spatial/index.cjs +954 -0
- package/dist/spatial/index.d.cts +136 -0
- package/dist/spatial/index.d.ts +136 -0
- package/dist/spatial/index.js +301 -0
- package/dist/stroke/index.cjs +1010 -0
- package/dist/stroke/index.d.cts +143 -0
- package/dist/stroke/index.d.ts +143 -0
- package/dist/stroke/index.js +343 -0
- package/package.json +122 -58
- package/dist/bundle.js +0 -5888
- package/dist/core/animation/animationruntime.d.ts +0 -238
- package/dist/core/animation/animationruntime.d.ts.map +0 -1
- package/dist/core/animation/animationruntime.js +0 -530
- package/dist/core/animation/animationruntime.js.map +0 -1
- package/dist/core/animation/animationstate.d.ts +0 -85
- package/dist/core/animation/animationstate.d.ts.map +0 -1
- package/dist/core/animation/animationstate.js +0 -119
- package/dist/core/animation/animationstate.js.map +0 -1
- package/dist/core/animation/animationtrack.d.ts +0 -55
- package/dist/core/animation/animationtrack.d.ts.map +0 -1
- package/dist/core/animation/animationtrack.js +0 -185
- package/dist/core/animation/animationtrack.js.map +0 -1
- package/dist/core/animation/easing.d.ts +0 -80
- package/dist/core/animation/easing.d.ts.map +0 -1
- package/dist/core/animation/easing.js +0 -126
- package/dist/core/animation/easing.js.map +0 -1
- package/dist/core/animation/index.d.ts +0 -11
- package/dist/core/animation/index.d.ts.map +0 -1
- package/dist/core/animation/index.js +0 -10
- package/dist/core/animation/index.js.map +0 -1
- package/dist/core/animation/interpolator.d.ts +0 -82
- package/dist/core/animation/interpolator.d.ts.map +0 -1
- package/dist/core/animation/interpolator.js +0 -108
- package/dist/core/animation/interpolator.js.map +0 -1
- package/dist/core/animation/keyframe.d.ts +0 -52
- package/dist/core/animation/keyframe.d.ts.map +0 -1
- package/dist/core/animation/keyframe.js +0 -65
- package/dist/core/animation/keyframe.js.map +0 -1
- package/dist/core/animation/logger.d.ts +0 -8
- package/dist/core/animation/logger.d.ts.map +0 -1
- package/dist/core/animation/logger.js +0 -20
- package/dist/core/animation/logger.js.map +0 -1
- package/dist/core/animation/statemachine.d.ts +0 -178
- package/dist/core/animation/statemachine.d.ts.map +0 -1
- package/dist/core/animation/statemachine.js +0 -378
- package/dist/core/animation/statemachine.js.map +0 -1
- package/dist/core/animation/statetransition.d.ts +0 -142
- package/dist/core/animation/statetransition.d.ts.map +0 -1
- package/dist/core/animation/statetransition.js +0 -189
- package/dist/core/animation/statetransition.js.map +0 -1
- package/dist/core/animation/timeline.d.ts +0 -62
- package/dist/core/animation/timeline.d.ts.map +0 -1
- package/dist/core/animation/timeline.js +0 -102
- package/dist/core/animation/timeline.js.map +0 -1
- package/dist/core/api.d.ts +0 -245
- package/dist/core/api.d.ts.map +0 -1
- package/dist/core/api.js +0 -369
- package/dist/core/api.js.map +0 -1
- package/dist/core/asset/assetmanager.d.ts +0 -196
- package/dist/core/asset/assetmanager.d.ts.map +0 -1
- package/dist/core/asset/assetmanager.js +0 -502
- package/dist/core/asset/assetmanager.js.map +0 -1
- package/dist/core/asset/index.d.ts +0 -3
- package/dist/core/asset/index.d.ts.map +0 -1
- package/dist/core/asset/index.js +0 -3
- package/dist/core/asset/index.js.map +0 -1
- package/dist/core/asset/types.d.ts +0 -36
- package/dist/core/asset/types.d.ts.map +0 -1
- package/dist/core/asset/types.js +0 -1
- package/dist/core/asset/types.js.map +0 -1
- package/dist/core/command/basecommand.d.ts +0 -29
- package/dist/core/command/basecommand.d.ts.map +0 -1
- package/dist/core/command/basecommand.js +0 -36
- package/dist/core/command/basecommand.js.map +0 -1
- package/dist/core/command/command.d.ts +0 -55
- package/dist/core/command/command.d.ts.map +0 -1
- package/dist/core/command/command.js +0 -1
- package/dist/core/command/command.js.map +0 -1
- package/dist/core/command/commandhistory.d.ts +0 -76
- package/dist/core/command/commandhistory.d.ts.map +0 -1
- package/dist/core/command/commandhistory.js +0 -122
- package/dist/core/command/commandhistory.js.map +0 -1
- package/dist/core/command/editorcommands.d.ts +0 -108
- package/dist/core/command/editorcommands.d.ts.map +0 -1
- package/dist/core/command/editorcommands.js +0 -274
- package/dist/core/command/editorcommands.js.map +0 -1
- package/dist/core/command/index.d.ts +0 -5
- package/dist/core/command/index.d.ts.map +0 -1
- package/dist/core/command/index.js +0 -5
- package/dist/core/command/index.js.map +0 -1
- package/dist/core/editor/events/emitter.d.ts +0 -45
- package/dist/core/editor/events/emitter.d.ts.map +0 -1
- package/dist/core/editor/events/emitter.js +0 -88
- package/dist/core/editor/events/emitter.js.map +0 -1
- package/dist/core/error/animationerror.d.ts +0 -27
- package/dist/core/error/animationerror.d.ts.map +0 -1
- package/dist/core/error/animationerror.js +0 -41
- package/dist/core/error/animationerror.js.map +0 -1
- package/dist/core/error/asseterror.d.ts +0 -32
- package/dist/core/error/asseterror.d.ts.map +0 -1
- package/dist/core/error/asseterror.js +0 -48
- package/dist/core/error/asseterror.js.map +0 -1
- package/dist/core/error/index.d.ts +0 -7
- package/dist/core/error/index.d.ts.map +0 -1
- package/dist/core/error/index.js +0 -7
- package/dist/core/error/index.js.map +0 -1
- package/dist/core/error/pluginerror.d.ts +0 -22
- package/dist/core/error/pluginerror.d.ts.map +0 -1
- package/dist/core/error/pluginerror.js +0 -33
- package/dist/core/error/pluginerror.js.map +0 -1
- package/dist/core/error/renderererror.d.ts +0 -26
- package/dist/core/error/renderererror.d.ts.map +0 -1
- package/dist/core/error/renderererror.js +0 -40
- package/dist/core/error/renderererror.js.map +0 -1
- package/dist/core/error/samcanerror.d.ts +0 -72
- package/dist/core/error/samcanerror.d.ts.map +0 -1
- package/dist/core/error/samcanerror.js +0 -108
- package/dist/core/error/samcanerror.js.map +0 -1
- package/dist/core/error/serializationerror.d.ts +0 -31
- package/dist/core/error/serializationerror.d.ts.map +0 -1
- package/dist/core/error/serializationerror.js +0 -46
- package/dist/core/error/serializationerror.js.map +0 -1
- package/dist/core/index.d.ts +0 -12
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -12
- package/dist/core/index.js.map +0 -1
- package/dist/core/math/color.d.ts +0 -56
- package/dist/core/math/color.d.ts.map +0 -1
- package/dist/core/math/color.js +0 -125
- package/dist/core/math/color.js.map +0 -1
- package/dist/core/math/index.d.ts +0 -14
- package/dist/core/math/index.d.ts.map +0 -1
- package/dist/core/math/index.js +0 -14
- package/dist/core/math/index.js.map +0 -1
- package/dist/core/math/matrix.d.ts +0 -101
- package/dist/core/math/matrix.d.ts.map +0 -1
- package/dist/core/math/matrix.js +0 -177
- package/dist/core/math/matrix.js.map +0 -1
- package/dist/core/math/paint.d.ts +0 -104
- package/dist/core/math/paint.d.ts.map +0 -1
- package/dist/core/math/paint.js +0 -204
- package/dist/core/math/paint.js.map +0 -1
- package/dist/core/math/path/index.d.ts +0 -94
- package/dist/core/math/path/index.d.ts.map +0 -1
- package/dist/core/math/path/index.js +0 -180
- package/dist/core/math/path/index.js.map +0 -1
- package/dist/core/math/path/operations.d.ts +0 -38
- package/dist/core/math/path/operations.d.ts.map +0 -1
- package/dist/core/math/path/operations.js +0 -149
- package/dist/core/math/path/operations.js.map +0 -1
- package/dist/core/math/pool.d.ts +0 -54
- package/dist/core/math/pool.d.ts.map +0 -1
- package/dist/core/math/pool.js +0 -97
- package/dist/core/math/pool.js.map +0 -1
- package/dist/core/math/pools.d.ts +0 -29
- package/dist/core/math/pools.d.ts.map +0 -1
- package/dist/core/math/pools.js +0 -50
- package/dist/core/math/pools.js.map +0 -1
- package/dist/core/math/rectangle.d.ts +0 -68
- package/dist/core/math/rectangle.d.ts.map +0 -1
- package/dist/core/math/rectangle.js +0 -124
- package/dist/core/math/rectangle.js.map +0 -1
- package/dist/core/math/utils.d.ts +0 -68
- package/dist/core/math/utils.d.ts.map +0 -1
- package/dist/core/math/utils.js +0 -110
- package/dist/core/math/utils.js.map +0 -1
- package/dist/core/math/vector2.d.ts +0 -85
- package/dist/core/math/vector2.d.ts.map +0 -1
- package/dist/core/math/vector2.js +0 -134
- package/dist/core/math/vector2.js.map +0 -1
- package/dist/core/plugin/animationcontroller.d.ts +0 -43
- package/dist/core/plugin/animationcontroller.d.ts.map +0 -1
- package/dist/core/plugin/animationcontroller.js +0 -11
- package/dist/core/plugin/animationcontroller.js.map +0 -1
- package/dist/core/plugin/index.d.ts +0 -6
- package/dist/core/plugin/index.d.ts.map +0 -1
- package/dist/core/plugin/index.js +0 -4
- package/dist/core/plugin/index.js.map +0 -1
- package/dist/core/plugin/plugin.d.ts +0 -53
- package/dist/core/plugin/plugin.d.ts.map +0 -1
- package/dist/core/plugin/plugin.js +0 -29
- package/dist/core/plugin/plugin.js.map +0 -1
- package/dist/core/plugin/pluginregistry.d.ts +0 -71
- package/dist/core/plugin/pluginregistry.d.ts.map +0 -1
- package/dist/core/plugin/pluginregistry.js +0 -143
- package/dist/core/plugin/pluginregistry.js.map +0 -1
- package/dist/core/renderer/batchmanager.d.ts +0 -68
- package/dist/core/renderer/batchmanager.d.ts.map +0 -1
- package/dist/core/renderer/batchmanager.js +0 -82
- package/dist/core/renderer/batchmanager.js.map +0 -1
- package/dist/core/renderer/canvas2drenderer.d.ts +0 -139
- package/dist/core/renderer/canvas2drenderer.d.ts.map +0 -1
- package/dist/core/renderer/canvas2drenderer.js +0 -499
- package/dist/core/renderer/canvas2drenderer.js.map +0 -1
- package/dist/core/renderer/dirtyregionmanager.d.ts +0 -54
- package/dist/core/renderer/dirtyregionmanager.d.ts.map +0 -1
- package/dist/core/renderer/dirtyregionmanager.js +0 -129
- package/dist/core/renderer/dirtyregionmanager.js.map +0 -1
- package/dist/core/renderer/index.d.ts +0 -8
- package/dist/core/renderer/index.d.ts.map +0 -1
- package/dist/core/renderer/index.js +0 -6
- package/dist/core/renderer/index.js.map +0 -1
- package/dist/core/renderer/renderer.d.ts +0 -154
- package/dist/core/renderer/renderer.d.ts.map +0 -1
- package/dist/core/renderer/renderer.js +0 -1
- package/dist/core/renderer/renderer.js.map +0 -1
- package/dist/core/renderer/rendererfactory.d.ts +0 -66
- package/dist/core/renderer/rendererfactory.d.ts.map +0 -1
- package/dist/core/renderer/rendererfactory.js +0 -219
- package/dist/core/renderer/rendererfactory.js.map +0 -1
- package/dist/core/renderer/webglrenderer.d.ts +0 -185
- package/dist/core/renderer/webglrenderer.d.ts.map +0 -1
- package/dist/core/renderer/webglrenderer.js +0 -1007
- package/dist/core/renderer/webglrenderer.js.map +0 -1
- package/dist/core/scene/index.d.ts +0 -4
- package/dist/core/scene/index.d.ts.map +0 -1
- package/dist/core/scene/index.js +0 -4
- package/dist/core/scene/index.js.map +0 -1
- package/dist/core/scene/node.d.ts +0 -162
- package/dist/core/scene/node.d.ts.map +0 -1
- package/dist/core/scene/node.js +0 -402
- package/dist/core/scene/node.js.map +0 -1
- package/dist/core/scene/nodes/artboard.d.ts +0 -42
- package/dist/core/scene/nodes/artboard.d.ts.map +0 -1
- package/dist/core/scene/nodes/artboard.js +0 -64
- package/dist/core/scene/nodes/artboard.js.map +0 -1
- package/dist/core/scene/nodes/groupnode.d.ts +0 -10
- package/dist/core/scene/nodes/groupnode.d.ts.map +0 -1
- package/dist/core/scene/nodes/groupnode.js +0 -12
- package/dist/core/scene/nodes/groupnode.js.map +0 -1
- package/dist/core/scene/nodes/imagenode.d.ts +0 -38
- package/dist/core/scene/nodes/imagenode.d.ts.map +0 -1
- package/dist/core/scene/nodes/imagenode.js +0 -77
- package/dist/core/scene/nodes/imagenode.js.map +0 -1
- package/dist/core/scene/nodes/index.d.ts +0 -5
- package/dist/core/scene/nodes/index.d.ts.map +0 -1
- package/dist/core/scene/nodes/index.js +0 -5
- package/dist/core/scene/nodes/index.js.map +0 -1
- package/dist/core/scene/nodes/shapenode.d.ts +0 -76
- package/dist/core/scene/nodes/shapenode.d.ts.map +0 -1
- package/dist/core/scene/nodes/shapenode.js +0 -212
- package/dist/core/scene/nodes/shapenode.js.map +0 -1
- package/dist/core/scene/transform.d.ts +0 -27
- package/dist/core/scene/transform.d.ts.map +0 -1
- package/dist/core/scene/transform.js +0 -52
- package/dist/core/scene/transform.js.map +0 -1
- package/dist/core/serialization/index.d.ts +0 -3
- package/dist/core/serialization/index.d.ts.map +0 -1
- package/dist/core/serialization/index.js +0 -2
- package/dist/core/serialization/index.js.map +0 -1
- package/dist/core/serialization/serializer.d.ts +0 -323
- package/dist/core/serialization/serializer.d.ts.map +0 -1
- package/dist/core/serialization/serializer.js +0 -1173
- package/dist/core/serialization/serializer.js.map +0 -1
- package/dist/core/serialization/types.d.ts +0 -242
- package/dist/core/serialization/types.d.ts.map +0 -1
- package/dist/core/serialization/types.js +0 -1
- package/dist/core/serialization/types.js.map +0 -1
- package/dist/core/timing/clock.d.ts +0 -43
- package/dist/core/timing/clock.d.ts.map +0 -1
- package/dist/core/timing/clock.js +0 -78
- package/dist/core/timing/clock.js.map +0 -1
- package/dist/core/timing/index.d.ts +0 -3
- package/dist/core/timing/index.d.ts.map +0 -1
- package/dist/core/timing/index.js +0 -3
- package/dist/core/timing/index.js.map +0 -1
- package/dist/core/timing/scheduler.d.ts +0 -72
- package/dist/core/timing/scheduler.d.ts.map +0 -1
- package/dist/core/timing/scheduler.js +0 -163
- package/dist/core/timing/scheduler.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/wrapper/react/index.d.ts +0 -5
- package/dist/wrapper/react/index.d.ts.map +0 -1
- package/dist/wrapper/react/index.js +0 -3
- package/dist/wrapper/react/index.js.map +0 -1
- package/dist/wrapper/react/samcan-player.d.ts +0 -26
- package/dist/wrapper/react/samcan-player.d.ts.map +0 -1
- package/dist/wrapper/react/samcan-player.js +0 -19
- package/dist/wrapper/react/samcan-player.js.map +0 -1
- package/dist/wrapper/react/use-samcan-player.d.ts +0 -33
- package/dist/wrapper/react/use-samcan-player.d.ts.map +0 -1
- package/dist/wrapper/react/use-samcan-player.js +0 -65
- package/dist/wrapper/react/use-samcan-player.js.map +0 -1
- package/readme.md +0 -96
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Vector2 } from "./vector2";
|
|
2
|
-
/**
|
|
3
|
-
* Rectangle class for bounding boxes and spatial operations
|
|
4
|
-
*/
|
|
5
|
-
export declare class Rectangle {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
11
|
-
/**
|
|
12
|
-
* Get the left edge as a Vector2
|
|
13
|
-
*/
|
|
14
|
-
get left(): Vector2;
|
|
15
|
-
/**
|
|
16
|
-
* Get the right edge as a Vector2
|
|
17
|
-
*/
|
|
18
|
-
get right(): Vector2;
|
|
19
|
-
/**
|
|
20
|
-
* Get the top edge as a Vector2
|
|
21
|
-
*/
|
|
22
|
-
get top(): Vector2;
|
|
23
|
-
/**
|
|
24
|
-
* Get the bottom edge as a Vector2
|
|
25
|
-
*/
|
|
26
|
-
get bottom(): Vector2;
|
|
27
|
-
/**
|
|
28
|
-
* Get the center point of the rectangle as a Vector2
|
|
29
|
-
*/
|
|
30
|
-
get center(): Vector2;
|
|
31
|
-
/**
|
|
32
|
-
* Check if a point is inside this rectangle
|
|
33
|
-
*/
|
|
34
|
-
contains(point: Vector2): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Check if this rectangle intersects with another rectangle
|
|
37
|
-
*/
|
|
38
|
-
intersects(other: Rectangle): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Get the intersection of this rectangle with another
|
|
41
|
-
*/
|
|
42
|
-
intersection(other: Rectangle): Rectangle | null;
|
|
43
|
-
/**
|
|
44
|
-
* Get the union of this rectangle with another
|
|
45
|
-
*/
|
|
46
|
-
boundingBoxUnion(other: Rectangle): Rectangle;
|
|
47
|
-
/**
|
|
48
|
-
* Expand this rectangle by a margin
|
|
49
|
-
*/
|
|
50
|
-
expand(margin: number): Rectangle;
|
|
51
|
-
/**
|
|
52
|
-
* Create a copy of this rectangle
|
|
53
|
-
*/
|
|
54
|
-
clone(): Rectangle;
|
|
55
|
-
/**
|
|
56
|
-
* Check if this rectangle equals another rectangle
|
|
57
|
-
*/
|
|
58
|
-
equals(other: Rectangle, epsilon?: number): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Create a rectangle from two points
|
|
61
|
-
*/
|
|
62
|
-
static fromPoints(p1: Vector2, p2: Vector2): Rectangle;
|
|
63
|
-
/**
|
|
64
|
-
* Create a rectangle from center and size
|
|
65
|
-
*/
|
|
66
|
-
static fromCenter(center: Vector2, width: number, height: number): Rectangle;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=rectangle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rectangle.d.ts","sourceRoot":"","sources":["../../../core/math/rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;GAEG;AACH,qBAAa,SAAS;IAEP,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAAM;IACT,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;gBAHd,CAAC,GAAE,MAAU,EACb,CAAC,GAAE,MAAU,EACb,KAAK,GAAE,MAAU,EACjB,MAAM,GAAE,MAAU;IAG7B;;OAEG;IACH,IAAI,IAAI,IAAI,OAAO,CAElB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED;;OAEG;IACH,IAAI,GAAG,IAAI,OAAO,CAEjB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IASjC;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IASrC;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI;IAWhD;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS;IAU7C;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IASjC;;OAEG;IACH,KAAK,IAAI,SAAS;IAIlB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,MAAe,GAAG,OAAO;IAS3D;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,GAAG,SAAS;IAQtD;;OAEG;IACH,MAAM,CAAC,UAAU,CACb,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACf,SAAS;CAQf"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { Vector2 } from "./vector2";
|
|
2
|
-
/**
|
|
3
|
-
* Rectangle class for bounding boxes and spatial operations
|
|
4
|
-
*/
|
|
5
|
-
export class Rectangle {
|
|
6
|
-
x;
|
|
7
|
-
y;
|
|
8
|
-
width;
|
|
9
|
-
height;
|
|
10
|
-
constructor(x = 0, y = 0, width = 0, height = 0) {
|
|
11
|
-
this.x = x;
|
|
12
|
-
this.y = y;
|
|
13
|
-
this.width = width;
|
|
14
|
-
this.height = height;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get the left edge as a Vector2
|
|
18
|
-
*/
|
|
19
|
-
get left() {
|
|
20
|
-
return new Vector2(this.x, 0);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get the right edge as a Vector2
|
|
24
|
-
*/
|
|
25
|
-
get right() {
|
|
26
|
-
return new Vector2(this.x + this.width, 0);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Get the top edge as a Vector2
|
|
30
|
-
*/
|
|
31
|
-
get top() {
|
|
32
|
-
return new Vector2(0, this.y + this.height);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Get the bottom edge as a Vector2
|
|
36
|
-
*/
|
|
37
|
-
get bottom() {
|
|
38
|
-
return new Vector2(0, this.y);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Get the center point of the rectangle as a Vector2
|
|
42
|
-
*/
|
|
43
|
-
get center() {
|
|
44
|
-
return new Vector2(this.x + this.width / 2, this.y + this.height / 2);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Check if a point is inside this rectangle
|
|
48
|
-
*/
|
|
49
|
-
contains(point) {
|
|
50
|
-
return (point.x >= this.x &&
|
|
51
|
-
point.x <= this.x + this.width &&
|
|
52
|
-
point.y >= this.y &&
|
|
53
|
-
point.y <= this.y + this.height);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Check if this rectangle intersects with another rectangle
|
|
57
|
-
*/
|
|
58
|
-
intersects(other) {
|
|
59
|
-
return (this.left.x < other.right.x &&
|
|
60
|
-
this.right.x > other.left.x &&
|
|
61
|
-
this.bottom.y < other.top.y &&
|
|
62
|
-
this.top.y > other.bottom.y);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get the intersection of this rectangle with another
|
|
66
|
-
*/
|
|
67
|
-
intersection(other) {
|
|
68
|
-
if (!this.intersects(other))
|
|
69
|
-
return null;
|
|
70
|
-
const x = Math.max(this.left.x, other.left.x);
|
|
71
|
-
const y = Math.max(this.top.y, other.top.y);
|
|
72
|
-
const right = Math.min(this.right.x, other.right.x);
|
|
73
|
-
const top = Math.min(this.top.y, other.top.y);
|
|
74
|
-
return new Rectangle(x, y, right - x, top - y);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Get the union of this rectangle with another
|
|
78
|
-
*/
|
|
79
|
-
boundingBoxUnion(other) {
|
|
80
|
-
const minX = Math.min(this.left.x, other.left.x);
|
|
81
|
-
const maxX = Math.max(this.right.x, other.right.x);
|
|
82
|
-
const minY = Math.min(this.bottom.y, other.bottom.y);
|
|
83
|
-
const maxY = Math.max(this.top.y, other.top.y);
|
|
84
|
-
return new Rectangle(minX, minY, maxX - minX, maxY - minY);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Expand this rectangle by a margin
|
|
88
|
-
*/
|
|
89
|
-
expand(margin) {
|
|
90
|
-
return new Rectangle(this.x - margin, this.y - margin, this.width + margin * 2, this.height + margin * 2);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Create a copy of this rectangle
|
|
94
|
-
*/
|
|
95
|
-
clone() {
|
|
96
|
-
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Check if this rectangle equals another rectangle
|
|
100
|
-
*/
|
|
101
|
-
equals(other, epsilon = 0.0001) {
|
|
102
|
-
return (Math.abs(this.x - other.x) < epsilon &&
|
|
103
|
-
Math.abs(this.y - other.y) < epsilon &&
|
|
104
|
-
Math.abs(this.width - other.width) < epsilon &&
|
|
105
|
-
Math.abs(this.height - other.height) < epsilon);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Create a rectangle from two points
|
|
109
|
-
*/
|
|
110
|
-
static fromPoints(p1, p2) {
|
|
111
|
-
const x = Math.min(p1.x, p2.x);
|
|
112
|
-
const y = Math.min(p1.y, p2.y);
|
|
113
|
-
const width = Math.abs(p2.x - p1.x);
|
|
114
|
-
const height = Math.abs(p2.y - p1.y);
|
|
115
|
-
return new Rectangle(x, y, width, height);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Create a rectangle from center and size
|
|
119
|
-
*/
|
|
120
|
-
static fromCenter(center, width, height) {
|
|
121
|
-
return new Rectangle(center.x - width / 2, center.y - height / 2, width, height);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=rectangle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rectangle.js","sourceRoot":"","sources":["../../../core/math/rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;GAEG;AACH,MAAM,OAAO,SAAS;IAEP;IACA;IACA;IACA;IAJX,YACW,IAAY,CAAC,EACb,IAAY,CAAC,EACb,QAAgB,CAAC,EACjB,SAAiB,CAAC;QAHlB,MAAC,GAAD,CAAC,CAAY;QACb,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AAC,MAAM,CAAC,GAAG,OAAO,CACjD,CAAA;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,EAAW,EAAE,EAAW;QACtC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;QAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;QACpC,OAAO,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAC7C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CACb,MAAe,EACf,KAAa,EACb,MAAc;QAEd,OAAO,IAAI,SAAS,CAChB,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EACpB,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,EACrB,KAAK,EACL,MAAM,CACT,CAAA;IACL,CAAC;CACJ"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common math utility functions
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Linear interpolation between two values
|
|
6
|
-
*/
|
|
7
|
-
export declare function lerp(a: number, b: number, t: number): number;
|
|
8
|
-
/**
|
|
9
|
-
* Clamp a value between min and max
|
|
10
|
-
*/
|
|
11
|
-
export declare function clamp(value: number, min: number, max: number): number;
|
|
12
|
-
/**
|
|
13
|
-
* Map a value from one range to another
|
|
14
|
-
*/
|
|
15
|
-
export declare function map(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
16
|
-
/**
|
|
17
|
-
* Check if two numbers are approximately equal
|
|
18
|
-
*/
|
|
19
|
-
export declare function approximately(a: number, b: number, epsilon?: number): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Convert degrees to radians
|
|
22
|
-
*/
|
|
23
|
-
export declare function degToRad(degrees: number): number;
|
|
24
|
-
/**
|
|
25
|
-
* Convert radians to degrees
|
|
26
|
-
*/
|
|
27
|
-
export declare function radToDeg(radians: number): number;
|
|
28
|
-
/**
|
|
29
|
-
* Normalize an angle to the range [0, 2π)
|
|
30
|
-
*/
|
|
31
|
-
export declare function normalizeAngle(angle: number): number;
|
|
32
|
-
/**
|
|
33
|
-
* Get the shortest angular distance between two angles
|
|
34
|
-
*/
|
|
35
|
-
export declare function angleDelta(from: number, to: number): number;
|
|
36
|
-
/**
|
|
37
|
-
* Smooth step interpolation (cubic hermite)
|
|
38
|
-
*/
|
|
39
|
-
export declare function smoothstep(edge0: number, edge1: number, x: number): number;
|
|
40
|
-
/**
|
|
41
|
-
* Smoother step interpolation (quintic hermite)
|
|
42
|
-
*/
|
|
43
|
-
export declare function smootherstep(edge0: number, edge1: number, x: number): number;
|
|
44
|
-
/**
|
|
45
|
-
* Inverse lerp - find t for a value between a and b
|
|
46
|
-
*/
|
|
47
|
-
export declare function inverseLerp(a: number, b: number, value: number): number;
|
|
48
|
-
/**
|
|
49
|
-
* Ping-pong a value between 0 and length
|
|
50
|
-
*/
|
|
51
|
-
export declare function pingPong(t: number, length: number): number;
|
|
52
|
-
/**
|
|
53
|
-
* Repeat a value within a range
|
|
54
|
-
*/
|
|
55
|
-
export declare function repeat(t: number, length: number): number;
|
|
56
|
-
/**
|
|
57
|
-
* Sign function that returns -1, 0, or 1
|
|
58
|
-
*/
|
|
59
|
-
export declare function sign(value: number): number;
|
|
60
|
-
/**
|
|
61
|
-
* Cubic bezier interpolation
|
|
62
|
-
*/
|
|
63
|
-
export declare function cubicBezierInterpolate(t: number, p0: number, p1: number, p2: number, p3: number): number;
|
|
64
|
-
/**
|
|
65
|
-
* Quadratic bezier interpolation
|
|
66
|
-
*/
|
|
67
|
-
export declare function quadraticBezier(t: number, p0: number, p1: number, p2: number): number;
|
|
68
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../core/math/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;GAEG;AACH,wBAAgB,GAAG,CACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACf,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,aAAa,CACzB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,OAAO,GAAE,MAAe,GACzB,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG1E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAClC,CAAC,EAAE,MAAM,EACT,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACX,MAAM,CAQR;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC3B,CAAC,EAAE,MAAM,EACT,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACX,MAAM,CAGR"}
|
package/dist/core/math/utils.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common math utility functions
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Linear interpolation between two values
|
|
6
|
-
*/
|
|
7
|
-
export function lerp(a, b, t) {
|
|
8
|
-
return a + (b - a) * t;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Clamp a value between min and max
|
|
12
|
-
*/
|
|
13
|
-
export function clamp(value, min, max) {
|
|
14
|
-
return Math.max(min, Math.min(max, value));
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Map a value from one range to another
|
|
18
|
-
*/
|
|
19
|
-
export function map(value, inMin, inMax, outMin, outMax) {
|
|
20
|
-
return outMin + (outMax - outMin) * ((value - inMin) / (inMax - inMin));
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Check if two numbers are approximately equal
|
|
24
|
-
*/
|
|
25
|
-
export function approximately(a, b, epsilon = 0.0001) {
|
|
26
|
-
return Math.abs(a - b) < epsilon;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Convert degrees to radians
|
|
30
|
-
*/
|
|
31
|
-
export function degToRad(degrees) {
|
|
32
|
-
return degrees * (Math.PI / 180);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Convert radians to degrees
|
|
36
|
-
*/
|
|
37
|
-
export function radToDeg(radians) {
|
|
38
|
-
return radians * (180 / Math.PI);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Normalize an angle to the range [0, 2π)
|
|
42
|
-
*/
|
|
43
|
-
export function normalizeAngle(angle) {
|
|
44
|
-
const twoPi = Math.PI * 2;
|
|
45
|
-
return ((angle % twoPi) + twoPi) % twoPi;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Get the shortest angular distance between two angles
|
|
49
|
-
*/
|
|
50
|
-
export function angleDelta(from, to) {
|
|
51
|
-
const delta = normalizeAngle(to - from);
|
|
52
|
-
return delta > Math.PI ? delta - Math.PI * 2 : delta;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Smooth step interpolation (cubic hermite)
|
|
56
|
-
*/
|
|
57
|
-
export function smoothstep(edge0, edge1, x) {
|
|
58
|
-
const t = clamp((x - edge0) / (edge1 - edge0), 0, 1);
|
|
59
|
-
return t * t * (3 - 2 * t);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Smoother step interpolation (quintic hermite)
|
|
63
|
-
*/
|
|
64
|
-
export function smootherstep(edge0, edge1, x) {
|
|
65
|
-
const t = clamp((x - edge0) / (edge1 - edge0), 0, 1);
|
|
66
|
-
return t * t * t * (t * (t * 6 - 15) + 10);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Inverse lerp - find t for a value between a and b
|
|
70
|
-
*/
|
|
71
|
-
export function inverseLerp(a, b, value) {
|
|
72
|
-
return (value - a) / (b - a);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Ping-pong a value between 0 and length
|
|
76
|
-
*/
|
|
77
|
-
export function pingPong(t, length) {
|
|
78
|
-
t = t % (length * 2);
|
|
79
|
-
return length - Math.abs(t - length);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Repeat a value within a range
|
|
83
|
-
*/
|
|
84
|
-
export function repeat(t, length) {
|
|
85
|
-
return clamp(t - Math.floor(t / length) * length, 0, length);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Sign function that returns -1, 0, or 1
|
|
89
|
-
*/
|
|
90
|
-
export function sign(value) {
|
|
91
|
-
return value > 0 ? 1 : value < 0 ? -1 : 0;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Cubic bezier interpolation
|
|
95
|
-
*/
|
|
96
|
-
export function cubicBezierInterpolate(t, p0, p1, p2, p3) {
|
|
97
|
-
const oneMinusT = 1 - t;
|
|
98
|
-
return (oneMinusT * oneMinusT * oneMinusT * p0 +
|
|
99
|
-
3 * oneMinusT * oneMinusT * t * p1 +
|
|
100
|
-
3 * oneMinusT * t * t * p2 +
|
|
101
|
-
t * t * t * p3);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Quadratic bezier interpolation
|
|
105
|
-
*/
|
|
106
|
-
export function quadraticBezier(t, p0, p1, p2) {
|
|
107
|
-
const oneMinusT = 1 - t;
|
|
108
|
-
return oneMinusT * oneMinusT * p0 + 2 * oneMinusT * t * p1 + t * t * p2;
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=utils.js.map
|
|
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AC,GAAG,CAAC,GAAG,EAAE,CAAA;AAC3E,CAAC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 2D Vector class for position, scale, and direction operations
|
|
3
|
-
*/
|
|
4
|
-
export declare class Vector2 {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
constructor(x?: number, y?: number);
|
|
8
|
-
/**
|
|
9
|
-
* Add another vector to this vector
|
|
10
|
-
*/
|
|
11
|
-
add(other: Vector2): Vector2;
|
|
12
|
-
/**
|
|
13
|
-
* Subtract another vector from this vector
|
|
14
|
-
*/
|
|
15
|
-
subtract(other: Vector2): Vector2;
|
|
16
|
-
/**
|
|
17
|
-
* Multiply this vector by a scalar
|
|
18
|
-
*/
|
|
19
|
-
multiply(scalar: number): Vector2;
|
|
20
|
-
/**
|
|
21
|
-
* Divide this vector by a scalar
|
|
22
|
-
*/
|
|
23
|
-
divide(scalar: number): Vector2;
|
|
24
|
-
/**
|
|
25
|
-
* Calculate the dot product with another vector
|
|
26
|
-
*/
|
|
27
|
-
dot(other: Vector2): number;
|
|
28
|
-
/**
|
|
29
|
-
* Calculate the length (magnitude) of this vector
|
|
30
|
-
*/
|
|
31
|
-
length(): number;
|
|
32
|
-
/**
|
|
33
|
-
* Calculate the squared length (avoids sqrt for performance)
|
|
34
|
-
*/
|
|
35
|
-
lengthSquared(): number;
|
|
36
|
-
/**
|
|
37
|
-
* Return a normalized version of this vector (length = 1)
|
|
38
|
-
*/
|
|
39
|
-
normalize(): Vector2;
|
|
40
|
-
/**
|
|
41
|
-
* Calculate distance to another vector
|
|
42
|
-
*/
|
|
43
|
-
distance(other: Vector2): number;
|
|
44
|
-
/**
|
|
45
|
-
* Calculate squared distance to another vector
|
|
46
|
-
*/
|
|
47
|
-
distanceSquared(other: Vector2): number;
|
|
48
|
-
/**
|
|
49
|
-
* Create a copy of this vector
|
|
50
|
-
*/
|
|
51
|
-
clone(): Vector2;
|
|
52
|
-
/**
|
|
53
|
-
* Check if this vector equals another vector
|
|
54
|
-
*/
|
|
55
|
-
equals(other: Vector2, epsilon?: number): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Set the components of this vector
|
|
58
|
-
*/
|
|
59
|
-
set(x: number, y: number): Vector2;
|
|
60
|
-
/**
|
|
61
|
-
* Set this vector from another vector
|
|
62
|
-
*/
|
|
63
|
-
setFrom(other: Vector2): Vector2;
|
|
64
|
-
/**
|
|
65
|
-
* Linear interpolation between this vector and another
|
|
66
|
-
*/
|
|
67
|
-
lerp(other: Vector2, t: number): Vector2;
|
|
68
|
-
/**
|
|
69
|
-
* Create a zero vector
|
|
70
|
-
*/
|
|
71
|
-
static zero(): Vector2;
|
|
72
|
-
/**
|
|
73
|
-
* Create a unit vector (1, 1)
|
|
74
|
-
*/
|
|
75
|
-
static one(): Vector2;
|
|
76
|
-
/**
|
|
77
|
-
* Create a unit vector pointing right
|
|
78
|
-
*/
|
|
79
|
-
static right(): Vector2;
|
|
80
|
-
/**
|
|
81
|
-
* Create a unit vector pointing up
|
|
82
|
-
*/
|
|
83
|
-
static up(): Vector2;
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=vector2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vector2.d.ts","sourceRoot":"","sources":["../../../core/math/vector2.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,OAAO;IAEL,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAAM;gBADT,CAAC,GAAE,MAAU,EACb,CAAC,GAAE,MAAU;IAGxB;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAI5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIjC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIjC;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAI/B;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAI3B;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,SAAS,IAAI,OAAO;IAMpB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAIhC;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAIvC;;OAEG;IACH,KAAK,IAAI,OAAO;IAIhB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,MAAe,GAAG,OAAO;IAOzD;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IAMlC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAMhC;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IAOxC;;OAEG;IACH,MAAM,CAAC,IAAI,IAAI,OAAO;IAItB;;OAEG;IACH,MAAM,CAAC,GAAG,IAAI,OAAO;IAIrB;;OAEG;IACH,MAAM,CAAC,KAAK,IAAI,OAAO;IAIvB;;OAEG;IACH,MAAM,CAAC,EAAE,IAAI,OAAO;CAGvB"}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 2D Vector class for position, scale, and direction operations
|
|
3
|
-
*/
|
|
4
|
-
export class Vector2 {
|
|
5
|
-
x;
|
|
6
|
-
y;
|
|
7
|
-
constructor(x = 0, y = 0) {
|
|
8
|
-
this.x = x;
|
|
9
|
-
this.y = y;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Add another vector to this vector
|
|
13
|
-
*/
|
|
14
|
-
add(other) {
|
|
15
|
-
return new Vector2(this.x + other.x, this.y + other.y);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Subtract another vector from this vector
|
|
19
|
-
*/
|
|
20
|
-
subtract(other) {
|
|
21
|
-
return new Vector2(this.x - other.x, this.y - other.y);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Multiply this vector by a scalar
|
|
25
|
-
*/
|
|
26
|
-
multiply(scalar) {
|
|
27
|
-
return new Vector2(this.x * scalar, this.y * scalar);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Divide this vector by a scalar
|
|
31
|
-
*/
|
|
32
|
-
divide(scalar) {
|
|
33
|
-
return new Vector2(this.x / scalar, this.y / scalar);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Calculate the dot product with another vector
|
|
37
|
-
*/
|
|
38
|
-
dot(other) {
|
|
39
|
-
return this.x * other.x + this.y * other.y;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Calculate the length (magnitude) of this vector
|
|
43
|
-
*/
|
|
44
|
-
length() {
|
|
45
|
-
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Calculate the squared length (avoids sqrt for performance)
|
|
49
|
-
*/
|
|
50
|
-
lengthSquared() {
|
|
51
|
-
return this.x * this.x + this.y * this.y;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Return a normalized version of this vector (length = 1)
|
|
55
|
-
*/
|
|
56
|
-
normalize() {
|
|
57
|
-
const len = this.length();
|
|
58
|
-
if (len === 0)
|
|
59
|
-
return new Vector2(0, 0);
|
|
60
|
-
return this.divide(len);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Calculate distance to another vector
|
|
64
|
-
*/
|
|
65
|
-
distance(other) {
|
|
66
|
-
return this.subtract(other).length();
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Calculate squared distance to another vector
|
|
70
|
-
*/
|
|
71
|
-
distanceSquared(other) {
|
|
72
|
-
return this.subtract(other).lengthSquared();
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Create a copy of this vector
|
|
76
|
-
*/
|
|
77
|
-
clone() {
|
|
78
|
-
return new Vector2(this.x, this.y);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Check if this vector equals another vector
|
|
82
|
-
*/
|
|
83
|
-
equals(other, epsilon = 0.0001) {
|
|
84
|
-
return (Math.abs(this.x - other.x) < epsilon &&
|
|
85
|
-
Math.abs(this.y - other.y) < epsilon);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Set the components of this vector
|
|
89
|
-
*/
|
|
90
|
-
set(x, y) {
|
|
91
|
-
this.x = x;
|
|
92
|
-
this.y = y;
|
|
93
|
-
return this;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Set this vector from another vector
|
|
97
|
-
*/
|
|
98
|
-
setFrom(other) {
|
|
99
|
-
this.x = other.x;
|
|
100
|
-
this.y = other.y;
|
|
101
|
-
return this;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Linear interpolation between this vector and another
|
|
105
|
-
*/
|
|
106
|
-
lerp(other, t) {
|
|
107
|
-
return new Vector2(this.x + (other.x - this.x) * t, this.y + (other.y - this.y) * t);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Create a zero vector
|
|
111
|
-
*/
|
|
112
|
-
static zero() {
|
|
113
|
-
return new Vector2(0, 0);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Create a unit vector (1, 1)
|
|
117
|
-
*/
|
|
118
|
-
static one() {
|
|
119
|
-
return new Vector2(1, 1);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Create a unit vector pointing right
|
|
123
|
-
*/
|
|
124
|
-
static right() {
|
|
125
|
-
return new Vector2(1, 0);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Create a unit vector pointing up
|
|
129
|
-
*/
|
|
130
|
-
static up() {
|
|
131
|
-
return new Vector2(0, 1);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
//# sourceMappingURL=vector2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vector2.js","sourceRoot":"","sources":["../../../core/math/vector2.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,OAAO;IAEL;IACA;IAFX,YACW,IAAY,CAAC,EACb,IAAY,CAAC;QADb,MAAC,GAAD,CAAC,CAAY;QACb,MAAC,GAAD,CAAC,CAAY;IACrB,CAAC;IAEJ;;OAEG;IACH,GAAG,CAAC,KAAc;QACd,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;IAC1D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,KAAc;QACnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;IAC1D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,MAAc;QACnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAA;IACxD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAAc;QACjB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAA;IACxD,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,KAAc;QACd,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAA;IAC9C,CAAC;IAED;;OAEG;IACH,MAAM;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,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C,CAAA;QACV,OAAO,IAAI,CAAA;IACf,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,KAAc;QAClB,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAA;QAChB,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAA;QAChB,OAAO,IAAI,CAAA;IACf,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,KAAc,EAAE,CAAS;QAC1B,OAAO,IAAI,OAAO,CACd,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAC/B,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAClC,CAAA;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI;QACP,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,GAAG;QACN,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK;QACR,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,EAAE;QACL,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5B,CAAC;CACJ"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { AnimationState } from "../animation/animationstate";
|
|
2
|
-
import type { Plugin } from "./plugin";
|
|
3
|
-
/**
|
|
4
|
-
* AnimationController is a specialized plugin interface for controlling
|
|
5
|
-
* animation state machine behavior. Controllers can hook into state transitions
|
|
6
|
-
* and access animation data through a controlled API.
|
|
7
|
-
*
|
|
8
|
-
* Use cases:
|
|
9
|
-
* - Custom transition logic based on game state
|
|
10
|
-
* - Procedural animation modifications
|
|
11
|
-
* - Animation event handling and coordination
|
|
12
|
-
* - Dynamic parameter adjustments during playback
|
|
13
|
-
*/
|
|
14
|
-
export interface AnimationController extends Plugin {
|
|
15
|
-
/**
|
|
16
|
-
* Called when entering a new animation state.
|
|
17
|
-
* Use this to initialize state-specific behavior or modify animation parameters.
|
|
18
|
-
*
|
|
19
|
-
* @param state - The animation state being entered
|
|
20
|
-
*/
|
|
21
|
-
onStateEnter?(state: AnimationState): void;
|
|
22
|
-
/**
|
|
23
|
-
* Called when exiting an animation state.
|
|
24
|
-
* Use this to clean up state-specific resources or save state data.
|
|
25
|
-
*
|
|
26
|
-
* @param state - The animation state being exited
|
|
27
|
-
*/
|
|
28
|
-
onStateExit?(state: AnimationState): void;
|
|
29
|
-
/**
|
|
30
|
-
* Called during a state transition.
|
|
31
|
-
* Use this to customize transition behavior or blend parameters.
|
|
32
|
-
*
|
|
33
|
-
* @param from - The state being transitioned from
|
|
34
|
-
* @param to - The state being transitioned to
|
|
35
|
-
* @param progress - Transition progress from 0 to 1
|
|
36
|
-
*/
|
|
37
|
-
onTransition?(from: AnimationState, to: AnimationState, progress: number): void;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Type guard to check if a plugin implements the AnimationController interface
|
|
41
|
-
*/
|
|
42
|
-
export declare function isAnimationController(plugin: Plugin): plugin is AnimationController;
|
|
43
|
-
//# sourceMappingURL=animationcontroller.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"animationcontroller.d.ts","sourceRoot":"","sources":["../../../core/plugin/animationcontroller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAoB,SAAQ,MAAM;IAC/C;;;;;OAKG;IACH,YAAY,CAAC,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;IAE1C;;;;;OAKG;IACH,WAAW,CAAC,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;IAEzC;;;;;;;OAOG;IACH,YAAY,CAAC,CACT,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,cAAc,EAClB,QAAQ,EAAE,MAAM,GACjB,IAAI,CAAA;CACV;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACjC,MAAM,EAAE,MAAM,GACf,MAAM,IAAI,mBAAmB,CAS/B"}
|