modern-canvas 0.4.16 → 0.4.18
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/dist/index.cjs +114 -172
- package/dist/index.d.cts +15 -32
- package/dist/index.d.mts +15 -32
- package/dist/index.d.ts +15 -32
- package/dist/index.js +38 -38
- package/dist/index.mjs +114 -172
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1295,6 +1295,7 @@ class Matrix extends EventEmitter {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
1297
|
_array = [];
|
|
1298
|
+
dirtyId = 0;
|
|
1298
1299
|
get length() {
|
|
1299
1300
|
return this.cols * this.rows;
|
|
1300
1301
|
}
|
|
@@ -1399,6 +1400,7 @@ class Matrix extends EventEmitter {
|
|
|
1399
1400
|
return this._operate("*", value, output);
|
|
1400
1401
|
}
|
|
1401
1402
|
_onUpdate(_array) {
|
|
1403
|
+
this.dirtyId++;
|
|
1402
1404
|
}
|
|
1403
1405
|
toArray(transpose = false) {
|
|
1404
1406
|
const { cols, rows, _array: array } = this;
|
|
@@ -1980,150 +1982,90 @@ class Rect2 {
|
|
|
1980
1982
|
}
|
|
1981
1983
|
|
|
1982
1984
|
class Transform2D extends Matrix3 {
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
this
|
|
1986
|
-
}
|
|
1987
|
-
_cx = 1;
|
|
1988
|
-
_sx = 0;
|
|
1989
|
-
_cy = 0;
|
|
1990
|
-
_sy = 1;
|
|
1991
|
-
_translateX = 0;
|
|
1992
|
-
_translateY = 0;
|
|
1993
|
-
_translateZ = 1;
|
|
1994
|
-
_scaleX = 1;
|
|
1995
|
-
_scaleY = 1;
|
|
1996
|
-
_skewX = 0;
|
|
1997
|
-
_skewY = 0;
|
|
1998
|
-
_rotate = 0;
|
|
1999
|
-
dirtyId = 0;
|
|
2000
|
-
_needsUpdateArray = false;
|
|
2001
|
-
_needsUpdateFields = false;
|
|
2002
|
-
_onUpdate(array) {
|
|
2003
|
-
super._onUpdate(array);
|
|
2004
|
-
this._requestUpdateFields();
|
|
2005
|
-
}
|
|
2006
|
-
_updateSkew() {
|
|
2007
|
-
this._cx = Math.cos(this._rotate + this._skewY);
|
|
2008
|
-
this._sx = Math.sin(this._rotate + this._skewY);
|
|
2009
|
-
this._cy = -Math.sin(this._rotate - this._skewX);
|
|
2010
|
-
this._sy = Math.cos(this._rotate - this._skewX);
|
|
2011
|
-
}
|
|
2012
|
-
_requestUpdateArray() {
|
|
2013
|
-
if (this.autoUpdate) {
|
|
2014
|
-
this._performUpdateArray();
|
|
2015
|
-
} else {
|
|
2016
|
-
this._needsUpdateArray = true;
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
_requestUpdateFields() {
|
|
2020
|
-
if (this.autoUpdate) {
|
|
2021
|
-
this._performUpdateFields();
|
|
2022
|
-
} else {
|
|
2023
|
-
this._needsUpdateFields = true;
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
_performUpdateArray() {
|
|
2027
|
-
const a = this._cx * this._scaleX;
|
|
2028
|
-
const b = this._sx * this._scaleX;
|
|
2029
|
-
const c = this._cy * this._scaleY;
|
|
2030
|
-
const d = this._sy * this._scaleY;
|
|
2031
|
-
const tx = this._translateX;
|
|
2032
|
-
const ty = this._translateY;
|
|
2033
|
-
const tz = this._translateZ;
|
|
2034
|
-
const array = this._array;
|
|
2035
|
-
this._array = [
|
|
2036
|
-
a,
|
|
2037
|
-
c,
|
|
2038
|
-
tx,
|
|
2039
|
-
b,
|
|
2040
|
-
d,
|
|
2041
|
-
ty,
|
|
2042
|
-
array[6],
|
|
2043
|
-
array[7],
|
|
2044
|
-
tz
|
|
2045
|
-
];
|
|
2046
|
-
this.dirtyId++;
|
|
2047
|
-
}
|
|
2048
|
-
_performUpdateFields() {
|
|
2049
|
-
const {
|
|
2050
|
-
a,
|
|
2051
|
-
c,
|
|
2052
|
-
tx,
|
|
2053
|
-
b,
|
|
2054
|
-
d,
|
|
2055
|
-
ty,
|
|
2056
|
-
tz
|
|
2057
|
-
} = this.toObject();
|
|
2058
|
-
const skewX = -Math.atan2(-c, d);
|
|
2059
|
-
const skewY = Math.atan2(b, a);
|
|
2060
|
-
const delta = Math.abs(skewX + skewY);
|
|
2061
|
-
if (delta < 1e-5 || Math.abs(PI_2 - delta) < 1e-5) {
|
|
2062
|
-
this._rotate = skewY;
|
|
2063
|
-
this._skewX = this._skewY = 0;
|
|
2064
|
-
} else {
|
|
2065
|
-
this._rotate = 0;
|
|
2066
|
-
this._skewX = skewX;
|
|
2067
|
-
this._skewY = skewY;
|
|
2068
|
-
}
|
|
2069
|
-
this._scaleX = Math.sqrt(a * a + b * b);
|
|
2070
|
-
this._scaleY = Math.sqrt(c * c + d * d);
|
|
2071
|
-
this._translateX = tx;
|
|
2072
|
-
this._translateY = ty;
|
|
2073
|
-
this._translateZ = tz;
|
|
2074
|
-
this.dirtyId++;
|
|
2075
|
-
}
|
|
2076
|
-
skew(x, y) {
|
|
2077
|
-
this._skewX = x;
|
|
2078
|
-
this._skewY = y;
|
|
2079
|
-
this._updateSkew();
|
|
2080
|
-
this._requestUpdateArray();
|
|
2081
|
-
return this;
|
|
1985
|
+
static _t2d = /* @__PURE__ */ new Transform2D();
|
|
1986
|
+
premultiply(t2d) {
|
|
1987
|
+
return t2d.multiply(this, this);
|
|
2082
1988
|
}
|
|
2083
1989
|
skewX(x) {
|
|
2084
|
-
return this.skew(x,
|
|
1990
|
+
return this.skew(x, 1);
|
|
2085
1991
|
}
|
|
2086
1992
|
skewY(y) {
|
|
2087
|
-
return this.skew(
|
|
1993
|
+
return this.skew(1, y);
|
|
1994
|
+
}
|
|
1995
|
+
skew(x, y) {
|
|
1996
|
+
return this.premultiply(Transform2D._t2d.makeSkew(x, y));
|
|
2088
1997
|
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
1998
|
+
makeSkew(x, y) {
|
|
1999
|
+
const cx = Math.cos(y);
|
|
2000
|
+
const sx = Math.sin(y);
|
|
2001
|
+
const cy = -Math.sin(-x);
|
|
2002
|
+
const sy = Math.cos(-x);
|
|
2003
|
+
this.set([
|
|
2004
|
+
cx,
|
|
2005
|
+
cy,
|
|
2006
|
+
0,
|
|
2007
|
+
sx,
|
|
2008
|
+
sy,
|
|
2009
|
+
0,
|
|
2010
|
+
0,
|
|
2011
|
+
0,
|
|
2012
|
+
1
|
|
2013
|
+
]);
|
|
2094
2014
|
return this;
|
|
2095
2015
|
}
|
|
2096
2016
|
translateX(x) {
|
|
2097
|
-
return this.translate(x,
|
|
2017
|
+
return this.translate(x, 0);
|
|
2098
2018
|
}
|
|
2099
2019
|
translateY(y) {
|
|
2100
|
-
return this.translate(
|
|
2020
|
+
return this.translate(0, y);
|
|
2101
2021
|
}
|
|
2102
2022
|
translateZ(z) {
|
|
2103
|
-
return this.translate(
|
|
2023
|
+
return this.translate(0, 0, z);
|
|
2104
2024
|
}
|
|
2105
2025
|
translate3d(x, y, z) {
|
|
2106
2026
|
return this.translate(x, y, z);
|
|
2107
2027
|
}
|
|
2108
|
-
|
|
2109
|
-
this.
|
|
2110
|
-
|
|
2111
|
-
|
|
2028
|
+
translate(x, y, z = 0) {
|
|
2029
|
+
return this.premultiply(Transform2D._t2d.makeTranslation(x, y, z));
|
|
2030
|
+
}
|
|
2031
|
+
makeTranslation(x, y, _z = 0) {
|
|
2032
|
+
this.set([
|
|
2033
|
+
1,
|
|
2034
|
+
0,
|
|
2035
|
+
x,
|
|
2036
|
+
0,
|
|
2037
|
+
1,
|
|
2038
|
+
y,
|
|
2039
|
+
0,
|
|
2040
|
+
0,
|
|
2041
|
+
1
|
|
2042
|
+
]);
|
|
2112
2043
|
return this;
|
|
2113
2044
|
}
|
|
2114
2045
|
scaleX(x) {
|
|
2115
|
-
return this.scale(x,
|
|
2046
|
+
return this.scale(x, 1);
|
|
2116
2047
|
}
|
|
2117
2048
|
scaleY(y) {
|
|
2118
|
-
return this.scale(
|
|
2049
|
+
return this.scale(1, y);
|
|
2119
2050
|
}
|
|
2120
|
-
scale3d(x, y, z) {
|
|
2051
|
+
scale3d(x, y, z = 1) {
|
|
2121
2052
|
return this.scale(x, y, z);
|
|
2122
2053
|
}
|
|
2123
|
-
|
|
2124
|
-
this.
|
|
2125
|
-
|
|
2126
|
-
|
|
2054
|
+
scale(x, y, z = 1) {
|
|
2055
|
+
return this.premultiply(Transform2D._t2d.makeScale(x, y, z));
|
|
2056
|
+
}
|
|
2057
|
+
makeScale(x, y, z = 1) {
|
|
2058
|
+
this.set([
|
|
2059
|
+
x,
|
|
2060
|
+
0,
|
|
2061
|
+
0,
|
|
2062
|
+
0,
|
|
2063
|
+
y,
|
|
2064
|
+
0,
|
|
2065
|
+
0,
|
|
2066
|
+
0,
|
|
2067
|
+
z
|
|
2068
|
+
]);
|
|
2127
2069
|
return this;
|
|
2128
2070
|
}
|
|
2129
2071
|
rotateX(x) {
|
|
@@ -2135,6 +2077,9 @@ class Transform2D extends Matrix3 {
|
|
|
2135
2077
|
rotateZ(z) {
|
|
2136
2078
|
return this.rotate(z);
|
|
2137
2079
|
}
|
|
2080
|
+
rotate(rad) {
|
|
2081
|
+
return this.premultiply(Transform2D._t2d.makeRotation(rad));
|
|
2082
|
+
}
|
|
2138
2083
|
rotate3d(x, y, z, rad) {
|
|
2139
2084
|
const [rx, ry, rz] = this._rotate3d(x, y, z, rad);
|
|
2140
2085
|
rx && this.rotateX(rx);
|
|
@@ -2168,6 +2113,22 @@ class Transform2D extends Matrix3 {
|
|
|
2168
2113
|
return [rotateX, rotateY, rotateZ];
|
|
2169
2114
|
}
|
|
2170
2115
|
}
|
|
2116
|
+
makeRotation(theta) {
|
|
2117
|
+
const c = Math.cos(theta);
|
|
2118
|
+
const s = Math.sin(theta);
|
|
2119
|
+
this.set([
|
|
2120
|
+
c,
|
|
2121
|
+
-s,
|
|
2122
|
+
0,
|
|
2123
|
+
s,
|
|
2124
|
+
c,
|
|
2125
|
+
0,
|
|
2126
|
+
0,
|
|
2127
|
+
0,
|
|
2128
|
+
1
|
|
2129
|
+
]);
|
|
2130
|
+
return this;
|
|
2131
|
+
}
|
|
2171
2132
|
applyToPoint(x, y) {
|
|
2172
2133
|
const { a, c, tx, b, d, ty } = this.toObject();
|
|
2173
2134
|
return [
|
|
@@ -2178,20 +2139,6 @@ class Transform2D extends Matrix3 {
|
|
|
2178
2139
|
inverse() {
|
|
2179
2140
|
return this.clone().invert();
|
|
2180
2141
|
}
|
|
2181
|
-
update() {
|
|
2182
|
-
let updated = false;
|
|
2183
|
-
if (this._needsUpdateArray) {
|
|
2184
|
-
this._needsUpdateArray = false;
|
|
2185
|
-
this._performUpdateArray();
|
|
2186
|
-
updated = true;
|
|
2187
|
-
}
|
|
2188
|
-
if (this._needsUpdateFields) {
|
|
2189
|
-
this._needsUpdateFields = false;
|
|
2190
|
-
this._performUpdateFields();
|
|
2191
|
-
updated = true;
|
|
2192
|
-
}
|
|
2193
|
-
return updated;
|
|
2194
|
-
}
|
|
2195
2142
|
isIdentity() {
|
|
2196
2143
|
const { a, b, c, d, tx, ty } = this.toObject();
|
|
2197
2144
|
return a === 1 && b === 0 && c === 0 && d === 1 && tx === 0 && ty === 0;
|
|
@@ -4389,58 +4336,56 @@ function parseCSSFilter(filter) {
|
|
|
4389
4336
|
return m;
|
|
4390
4337
|
}
|
|
4391
4338
|
|
|
4392
|
-
function parseCSSTransform(transform, width, height) {
|
|
4393
|
-
const t2d = new Transform2D(false);
|
|
4339
|
+
function parseCSSTransform(transform, width, height, output = new Transform2D()) {
|
|
4394
4340
|
transform = !transform || transform === "none" ? "" : transform;
|
|
4395
4341
|
parseCssFunctions(transform, { width, height }).forEach(({ name, args }) => {
|
|
4396
4342
|
const values = args.map((arg) => arg.normalizedIntValue);
|
|
4397
|
-
const _temp = new Transform2D();
|
|
4398
4343
|
switch (name) {
|
|
4399
4344
|
case "translate":
|
|
4400
|
-
|
|
4345
|
+
output.translate(values[0] * width, (values[1] ?? values[0]) * height);
|
|
4401
4346
|
break;
|
|
4402
4347
|
case "translateX":
|
|
4403
|
-
|
|
4348
|
+
output.translateX(values[0] * width);
|
|
4404
4349
|
break;
|
|
4405
4350
|
case "translateY":
|
|
4406
|
-
|
|
4351
|
+
output.translateY(values[0] * height);
|
|
4407
4352
|
break;
|
|
4408
4353
|
case "translateZ":
|
|
4409
|
-
|
|
4354
|
+
output.translateZ(values[0]);
|
|
4410
4355
|
break;
|
|
4411
4356
|
case "translate3d":
|
|
4412
|
-
|
|
4357
|
+
output.translate3d(
|
|
4413
4358
|
values[0] * width,
|
|
4414
4359
|
(values[1] ?? values[0]) * height,
|
|
4415
4360
|
values[2] ?? values[1] ?? values[0]
|
|
4416
4361
|
);
|
|
4417
4362
|
break;
|
|
4418
4363
|
case "scale":
|
|
4419
|
-
|
|
4364
|
+
output.scale(values[0], values[1] ?? values[0]);
|
|
4420
4365
|
break;
|
|
4421
4366
|
case "scaleX":
|
|
4422
|
-
|
|
4367
|
+
output.scaleX(values[0]);
|
|
4423
4368
|
break;
|
|
4424
4369
|
case "scaleY":
|
|
4425
|
-
|
|
4370
|
+
output.scaleY(values[0]);
|
|
4426
4371
|
break;
|
|
4427
4372
|
case "scale3d":
|
|
4428
|
-
|
|
4373
|
+
output.scale3d(values[0], values[1] ?? values[0], values[2] ?? values[1] ?? values[0]);
|
|
4429
4374
|
break;
|
|
4430
4375
|
case "rotate":
|
|
4431
|
-
|
|
4376
|
+
output.rotate(values[0] * PI_2);
|
|
4432
4377
|
break;
|
|
4433
4378
|
case "rotateX":
|
|
4434
|
-
|
|
4379
|
+
output.rotateX(values[0] * PI_2);
|
|
4435
4380
|
break;
|
|
4436
4381
|
case "rotateY":
|
|
4437
|
-
|
|
4382
|
+
output.rotateY(values[0] * PI_2);
|
|
4438
4383
|
break;
|
|
4439
4384
|
case "rotateZ":
|
|
4440
|
-
|
|
4385
|
+
output.rotateZ(values[0] * PI_2);
|
|
4441
4386
|
break;
|
|
4442
4387
|
case "rotate3d":
|
|
4443
|
-
|
|
4388
|
+
output.rotate3d(
|
|
4444
4389
|
values[0] * PI_2,
|
|
4445
4390
|
(values[1] ?? values[0]) * PI_2,
|
|
4446
4391
|
(values[2] ?? values[1] ?? values[0]) * PI_2,
|
|
@@ -4448,22 +4393,20 @@ function parseCSSTransform(transform, width, height) {
|
|
|
4448
4393
|
);
|
|
4449
4394
|
break;
|
|
4450
4395
|
case "skew":
|
|
4451
|
-
|
|
4396
|
+
output.skew(values[0], values[0] ?? values[1]);
|
|
4452
4397
|
break;
|
|
4453
4398
|
case "skewX":
|
|
4454
|
-
|
|
4399
|
+
output.skewX(values[0]);
|
|
4455
4400
|
break;
|
|
4456
4401
|
case "skewY":
|
|
4457
|
-
|
|
4402
|
+
output.skewY(values[0]);
|
|
4458
4403
|
break;
|
|
4459
4404
|
case "matrix":
|
|
4460
|
-
|
|
4405
|
+
output.set(values);
|
|
4461
4406
|
break;
|
|
4462
4407
|
}
|
|
4463
|
-
t2d.multiply(_temp);
|
|
4464
4408
|
});
|
|
4465
|
-
|
|
4466
|
-
return t2d;
|
|
4409
|
+
return output;
|
|
4467
4410
|
}
|
|
4468
4411
|
|
|
4469
4412
|
function parseCSSTransformOrigin(transformOrigin) {
|
|
@@ -5715,13 +5658,14 @@ exports.Node = class Node extends CoreObject {
|
|
|
5715
5658
|
setParent(parent) {
|
|
5716
5659
|
if (!this._parent?.is(parent)) {
|
|
5717
5660
|
const oldParent = this._parent;
|
|
5661
|
+
if (oldParent) {
|
|
5662
|
+
this.emit("unparented", oldParent);
|
|
5663
|
+
}
|
|
5718
5664
|
this._parent = parent;
|
|
5719
|
-
this.setTree(parent?._tree);
|
|
5720
5665
|
if (parent) {
|
|
5721
5666
|
this.emit("parented", parent);
|
|
5722
|
-
} else if (oldParent) {
|
|
5723
|
-
this.emit("unparented", oldParent);
|
|
5724
5667
|
}
|
|
5668
|
+
this.setTree(parent?._tree);
|
|
5725
5669
|
}
|
|
5726
5670
|
return this;
|
|
5727
5671
|
}
|
|
@@ -8689,7 +8633,7 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
|
8689
8633
|
rotation = 0;
|
|
8690
8634
|
scale = new Vector2(1, 1);
|
|
8691
8635
|
skew = new Vector2();
|
|
8692
|
-
transform = new Transform2D(
|
|
8636
|
+
transform = new Transform2D();
|
|
8693
8637
|
globalPosition = new Vector2();
|
|
8694
8638
|
globalRotation = 0;
|
|
8695
8639
|
globalScale = new Vector2();
|
|
@@ -8701,7 +8645,7 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
|
8701
8645
|
this.setProperties(properties).append(nodes);
|
|
8702
8646
|
}
|
|
8703
8647
|
_updateTransform() {
|
|
8704
|
-
this.transform.identity().scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).translate(this.position.x, this.position.y)
|
|
8648
|
+
this.transform.identity().scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).rotate(this.rotation).translate(this.position.x, this.position.y);
|
|
8705
8649
|
}
|
|
8706
8650
|
_updateGlobalTransform() {
|
|
8707
8651
|
const parent = this.getParent();
|
|
@@ -8904,17 +8848,13 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
8904
8848
|
this.requestRedraw();
|
|
8905
8849
|
}
|
|
8906
8850
|
_updateTransform() {
|
|
8907
|
-
super._updateTransform();
|
|
8908
8851
|
const { width, height } = this.size;
|
|
8909
|
-
const cssTransform = parseCSSTransform(this.style.transform, width, height);
|
|
8910
|
-
cssTransform.multiply(this.transform, this.transform);
|
|
8911
|
-
const t3dT2dArr = this.transform.toArray();
|
|
8912
8852
|
const [originX, originY] = parseCSSTransformOrigin(this.style.transformOrigin);
|
|
8913
8853
|
const offsetX = originX * width;
|
|
8914
8854
|
const offsetY = originY * height;
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
this.transform.
|
|
8855
|
+
this.transform.identity().translate(-offsetX, -offsetY).scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).rotate(this.rotation);
|
|
8856
|
+
parseCSSTransform(this.style.transform, width, height, this.transform);
|
|
8857
|
+
this.transform.translate(offsetX + this.position.x, offsetY + this.position.y);
|
|
8918
8858
|
}
|
|
8919
8859
|
_updateGlobalTransform() {
|
|
8920
8860
|
super._updateGlobalTransform();
|
|
@@ -10197,10 +10137,12 @@ exports.Animation = class Animation extends exports.TimelineNode {
|
|
|
10197
10137
|
super();
|
|
10198
10138
|
this.setProperties(properties).append(children);
|
|
10199
10139
|
}
|
|
10200
|
-
|
|
10140
|
+
_parented(parent) {
|
|
10141
|
+
super._parented(parent);
|
|
10201
10142
|
this._updateCachedProps();
|
|
10202
10143
|
}
|
|
10203
|
-
|
|
10144
|
+
_unparented(oldParent) {
|
|
10145
|
+
super._unparented(oldParent);
|
|
10204
10146
|
this.cancel();
|
|
10205
10147
|
}
|
|
10206
10148
|
_process() {
|
package/dist/index.d.cts
CHANGED
|
@@ -356,6 +356,7 @@ declare abstract class Matrix extends EventEmitter {
|
|
|
356
356
|
readonly rows: number;
|
|
357
357
|
readonly cols: number;
|
|
358
358
|
protected _array: number[];
|
|
359
|
+
dirtyId: number;
|
|
359
360
|
get length(): number;
|
|
360
361
|
constructor(rows: number, cols: number, array?: number[]);
|
|
361
362
|
protected _operate(operator: string, target: MatrixLike | Vector, output?: MatrixOperateOutput): any;
|
|
@@ -509,51 +510,33 @@ interface Transform2DObject {
|
|
|
509
510
|
* | 0 | 0 | 1 |
|
|
510
511
|
*/
|
|
511
512
|
declare class Transform2D extends Matrix3 {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
protected _sx: number;
|
|
515
|
-
protected _cy: number;
|
|
516
|
-
protected _sy: number;
|
|
517
|
-
protected _translateX: number;
|
|
518
|
-
protected _translateY: number;
|
|
519
|
-
protected _translateZ: number;
|
|
520
|
-
protected _scaleX: number;
|
|
521
|
-
protected _scaleY: number;
|
|
522
|
-
protected _skewX: number;
|
|
523
|
-
protected _skewY: number;
|
|
524
|
-
protected _rotate: number;
|
|
525
|
-
dirtyId: number;
|
|
526
|
-
protected _needsUpdateArray: boolean;
|
|
527
|
-
protected _needsUpdateFields: boolean;
|
|
528
|
-
constructor(autoUpdate?: boolean);
|
|
529
|
-
protected _onUpdate(array: number[]): void;
|
|
530
|
-
protected _updateSkew(): void;
|
|
531
|
-
protected _requestUpdateArray(): void;
|
|
532
|
-
protected _requestUpdateFields(): void;
|
|
533
|
-
protected _performUpdateArray(): void;
|
|
534
|
-
protected _performUpdateFields(): void;
|
|
535
|
-
skew(x: number, y: number): this;
|
|
513
|
+
private static _t2d;
|
|
514
|
+
premultiply(t2d: Transform2D): this;
|
|
536
515
|
skewX(x: number): this;
|
|
537
516
|
skewY(y: number): this;
|
|
538
|
-
|
|
517
|
+
skew(x: number, y: number): this;
|
|
518
|
+
makeSkew(x: number, y: number): this;
|
|
539
519
|
translateX(x: number): this;
|
|
540
520
|
translateY(y: number): this;
|
|
541
521
|
translateZ(z: number): this;
|
|
542
522
|
translate3d(x: number, y: number, z: number): this;
|
|
543
|
-
|
|
523
|
+
translate(x: number, y: number, z?: number): this;
|
|
524
|
+
makeTranslation(x: number, y: number, _z?: number): this;
|
|
544
525
|
scaleX(x: number): this;
|
|
545
526
|
scaleY(y: number): this;
|
|
546
|
-
scale3d(x: number, y: number, z
|
|
547
|
-
|
|
527
|
+
scale3d(x: number, y: number, z?: number): this;
|
|
528
|
+
scale(x: number, y: number, z?: number): this;
|
|
529
|
+
makeScale(x: number, y: number, z?: number): this;
|
|
548
530
|
rotateX(x: number): this;
|
|
549
531
|
rotateY(y: number): this;
|
|
550
532
|
rotateZ(z: number): this;
|
|
533
|
+
rotate(rad: number): this;
|
|
551
534
|
rotate3d(x: number, y: number, z: number, rad: number): this;
|
|
552
535
|
protected _rotateToScale(rad: number): number;
|
|
553
536
|
protected _rotate3d(x: number, y: number, z: number, rad: number): number[];
|
|
537
|
+
makeRotation(theta: number): this;
|
|
554
538
|
applyToPoint(x: number, y: number): number[];
|
|
555
539
|
inverse(): this;
|
|
556
|
-
update(): boolean;
|
|
557
540
|
isIdentity(): boolean;
|
|
558
541
|
toObject(): Transform2DObject;
|
|
559
542
|
}
|
|
@@ -2228,8 +2211,8 @@ declare class Animation extends TimelineNode {
|
|
|
2228
2211
|
protected _cachedProps: RawWeakMap<any, Map<string, any>>;
|
|
2229
2212
|
protected _stoped: boolean;
|
|
2230
2213
|
constructor(properties?: Partial<AnimationProperties>, children?: Node[]);
|
|
2231
|
-
protected
|
|
2232
|
-
protected
|
|
2214
|
+
protected _parented(parent: Node): void;
|
|
2215
|
+
protected _unparented(oldParent: Node): void;
|
|
2233
2216
|
protected _process(): void;
|
|
2234
2217
|
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2235
2218
|
protected _getTargets(): any[];
|
|
@@ -2915,7 +2898,7 @@ type CSSFilterKey = 'hue-rotate' | 'saturate' | 'brightness' | 'contrast' | 'inv
|
|
|
2915
2898
|
type CSSFilters = Record<CSSFilterKey, number>;
|
|
2916
2899
|
declare function parseCSSFilter(filter: string): ColorMatrix;
|
|
2917
2900
|
|
|
2918
|
-
declare function parseCSSTransform(transform: string, width: number, height: number): Transform2D;
|
|
2901
|
+
declare function parseCSSTransform(transform: string, width: number, height: number, output?: Transform2D): Transform2D;
|
|
2919
2902
|
|
|
2920
2903
|
declare function parseCSSTransformOrigin(transformOrigin: string): number[];
|
|
2921
2904
|
|
package/dist/index.d.mts
CHANGED
|
@@ -356,6 +356,7 @@ declare abstract class Matrix extends EventEmitter {
|
|
|
356
356
|
readonly rows: number;
|
|
357
357
|
readonly cols: number;
|
|
358
358
|
protected _array: number[];
|
|
359
|
+
dirtyId: number;
|
|
359
360
|
get length(): number;
|
|
360
361
|
constructor(rows: number, cols: number, array?: number[]);
|
|
361
362
|
protected _operate(operator: string, target: MatrixLike | Vector, output?: MatrixOperateOutput): any;
|
|
@@ -509,51 +510,33 @@ interface Transform2DObject {
|
|
|
509
510
|
* | 0 | 0 | 1 |
|
|
510
511
|
*/
|
|
511
512
|
declare class Transform2D extends Matrix3 {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
protected _sx: number;
|
|
515
|
-
protected _cy: number;
|
|
516
|
-
protected _sy: number;
|
|
517
|
-
protected _translateX: number;
|
|
518
|
-
protected _translateY: number;
|
|
519
|
-
protected _translateZ: number;
|
|
520
|
-
protected _scaleX: number;
|
|
521
|
-
protected _scaleY: number;
|
|
522
|
-
protected _skewX: number;
|
|
523
|
-
protected _skewY: number;
|
|
524
|
-
protected _rotate: number;
|
|
525
|
-
dirtyId: number;
|
|
526
|
-
protected _needsUpdateArray: boolean;
|
|
527
|
-
protected _needsUpdateFields: boolean;
|
|
528
|
-
constructor(autoUpdate?: boolean);
|
|
529
|
-
protected _onUpdate(array: number[]): void;
|
|
530
|
-
protected _updateSkew(): void;
|
|
531
|
-
protected _requestUpdateArray(): void;
|
|
532
|
-
protected _requestUpdateFields(): void;
|
|
533
|
-
protected _performUpdateArray(): void;
|
|
534
|
-
protected _performUpdateFields(): void;
|
|
535
|
-
skew(x: number, y: number): this;
|
|
513
|
+
private static _t2d;
|
|
514
|
+
premultiply(t2d: Transform2D): this;
|
|
536
515
|
skewX(x: number): this;
|
|
537
516
|
skewY(y: number): this;
|
|
538
|
-
|
|
517
|
+
skew(x: number, y: number): this;
|
|
518
|
+
makeSkew(x: number, y: number): this;
|
|
539
519
|
translateX(x: number): this;
|
|
540
520
|
translateY(y: number): this;
|
|
541
521
|
translateZ(z: number): this;
|
|
542
522
|
translate3d(x: number, y: number, z: number): this;
|
|
543
|
-
|
|
523
|
+
translate(x: number, y: number, z?: number): this;
|
|
524
|
+
makeTranslation(x: number, y: number, _z?: number): this;
|
|
544
525
|
scaleX(x: number): this;
|
|
545
526
|
scaleY(y: number): this;
|
|
546
|
-
scale3d(x: number, y: number, z
|
|
547
|
-
|
|
527
|
+
scale3d(x: number, y: number, z?: number): this;
|
|
528
|
+
scale(x: number, y: number, z?: number): this;
|
|
529
|
+
makeScale(x: number, y: number, z?: number): this;
|
|
548
530
|
rotateX(x: number): this;
|
|
549
531
|
rotateY(y: number): this;
|
|
550
532
|
rotateZ(z: number): this;
|
|
533
|
+
rotate(rad: number): this;
|
|
551
534
|
rotate3d(x: number, y: number, z: number, rad: number): this;
|
|
552
535
|
protected _rotateToScale(rad: number): number;
|
|
553
536
|
protected _rotate3d(x: number, y: number, z: number, rad: number): number[];
|
|
537
|
+
makeRotation(theta: number): this;
|
|
554
538
|
applyToPoint(x: number, y: number): number[];
|
|
555
539
|
inverse(): this;
|
|
556
|
-
update(): boolean;
|
|
557
540
|
isIdentity(): boolean;
|
|
558
541
|
toObject(): Transform2DObject;
|
|
559
542
|
}
|
|
@@ -2228,8 +2211,8 @@ declare class Animation extends TimelineNode {
|
|
|
2228
2211
|
protected _cachedProps: RawWeakMap<any, Map<string, any>>;
|
|
2229
2212
|
protected _stoped: boolean;
|
|
2230
2213
|
constructor(properties?: Partial<AnimationProperties>, children?: Node[]);
|
|
2231
|
-
protected
|
|
2232
|
-
protected
|
|
2214
|
+
protected _parented(parent: Node): void;
|
|
2215
|
+
protected _unparented(oldParent: Node): void;
|
|
2233
2216
|
protected _process(): void;
|
|
2234
2217
|
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2235
2218
|
protected _getTargets(): any[];
|
|
@@ -2915,7 +2898,7 @@ type CSSFilterKey = 'hue-rotate' | 'saturate' | 'brightness' | 'contrast' | 'inv
|
|
|
2915
2898
|
type CSSFilters = Record<CSSFilterKey, number>;
|
|
2916
2899
|
declare function parseCSSFilter(filter: string): ColorMatrix;
|
|
2917
2900
|
|
|
2918
|
-
declare function parseCSSTransform(transform: string, width: number, height: number): Transform2D;
|
|
2901
|
+
declare function parseCSSTransform(transform: string, width: number, height: number, output?: Transform2D): Transform2D;
|
|
2919
2902
|
|
|
2920
2903
|
declare function parseCSSTransformOrigin(transformOrigin: string): number[];
|
|
2921
2904
|
|