konva 10.0.9 → 10.0.10
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/konva.js +90 -44
- package/konva.min.js +4 -4
- package/package.json +1 -1
- package/lib/Animation.d.ts +0 -24
- package/lib/Animation.js +0 -142
- package/lib/BezierFunctions.d.ts +0 -6
- package/lib/BezierFunctions.js +0 -784
- package/lib/Canvas.d.ts +0 -33
- package/lib/Canvas.js +0 -137
- package/lib/Container.d.ts +0 -54
- package/lib/Container.js +0 -316
- package/lib/Context.d.ts +0 -95
- package/lib/Context.js +0 -561
- package/lib/Core.d.ts +0 -3
- package/lib/Core.js +0 -3
- package/lib/DragAndDrop.d.ts +0 -17
- package/lib/DragAndDrop.js +0 -110
- package/lib/Factory.d.ts +0 -22
- package/lib/Factory.js +0 -123
- package/lib/FastLayer.d.ts +0 -4
- package/lib/FastLayer.js +0 -12
- package/lib/Global.d.ts +0 -37
- package/lib/Global.js +0 -66
- package/lib/Group.d.ts +0 -9
- package/lib/Group.js +0 -13
- package/lib/Layer.d.ts +0 -62
- package/lib/Layer.js +0 -305
- package/lib/Node.d.ts +0 -323
- package/lib/Node.js +0 -1532
- package/lib/PointerEvents.d.ts +0 -11
- package/lib/PointerEvents.js +0 -37
- package/lib/Shape.d.ts +0 -196
- package/lib/Shape.js +0 -548
- package/lib/Stage.d.ts +0 -86
- package/lib/Stage.js +0 -715
- package/lib/Tween.d.ts +0 -90
- package/lib/Tween.js +0 -531
- package/lib/Util.d.ts +0 -133
- package/lib/Util.js +0 -866
- package/lib/Validators.d.ts +0 -11
- package/lib/Validators.js +0 -178
- package/lib/_CoreInternals.d.ts +0 -220
- package/lib/_CoreInternals.js +0 -34
- package/lib/_FullInternals.d.ts +0 -302
- package/lib/_FullInternals.js +0 -80
- package/lib/canvas-backend.d.ts +0 -2
- package/lib/canvas-backend.js +0 -27
- package/lib/filters/Blur.d.ts +0 -2
- package/lib/filters/Blur.js +0 -235
- package/lib/filters/Brighten.d.ts +0 -2
- package/lib/filters/Brighten.js +0 -12
- package/lib/filters/Brightness.d.ts +0 -2
- package/lib/filters/Brightness.js +0 -8
- package/lib/filters/Contrast.d.ts +0 -2
- package/lib/filters/Contrast.js +0 -35
- package/lib/filters/Emboss.d.ts +0 -2
- package/lib/filters/Emboss.js +0 -101
- package/lib/filters/Enhance.d.ts +0 -2
- package/lib/filters/Enhance.js +0 -84
- package/lib/filters/Grayscale.d.ts +0 -2
- package/lib/filters/Grayscale.js +0 -9
- package/lib/filters/HSL.d.ts +0 -2
- package/lib/filters/HSL.js +0 -24
- package/lib/filters/HSV.d.ts +0 -2
- package/lib/filters/HSV.js +0 -23
- package/lib/filters/Invert.d.ts +0 -2
- package/lib/filters/Invert.js +0 -8
- package/lib/filters/Kaleidoscope.d.ts +0 -2
- package/lib/filters/Kaleidoscope.js +0 -133
- package/lib/filters/Mask.d.ts +0 -2
- package/lib/filters/Mask.js +0 -151
- package/lib/filters/Noise.d.ts +0 -2
- package/lib/filters/Noise.js +0 -12
- package/lib/filters/Pixelate.d.ts +0 -2
- package/lib/filters/Pixelate.js +0 -60
- package/lib/filters/Posterize.d.ts +0 -2
- package/lib/filters/Posterize.js +0 -10
- package/lib/filters/RGB.d.ts +0 -2
- package/lib/filters/RGB.js +0 -38
- package/lib/filters/RGBA.d.ts +0 -2
- package/lib/filters/RGBA.js +0 -49
- package/lib/filters/Sepia.d.ts +0 -2
- package/lib/filters/Sepia.js +0 -11
- package/lib/filters/Solarize.d.ts +0 -2
- package/lib/filters/Solarize.js +0 -14
- package/lib/filters/Threshold.d.ts +0 -2
- package/lib/filters/Threshold.js +0 -10
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -2
- package/lib/shapes/Arc.d.ts +0 -27
- package/lib/shapes/Arc.js +0 -60
- package/lib/shapes/Arrow.d.ts +0 -27
- package/lib/shapes/Arrow.js +0 -99
- package/lib/shapes/Circle.d.ts +0 -15
- package/lib/shapes/Circle.js +0 -33
- package/lib/shapes/Ellipse.d.ts +0 -18
- package/lib/shapes/Ellipse.js +0 -37
- package/lib/shapes/Image.d.ts +0 -29
- package/lib/shapes/Image.js +0 -131
- package/lib/shapes/Label.d.ts +0 -39
- package/lib/shapes/Label.js +0 -173
- package/lib/shapes/Line.d.ts +0 -29
- package/lib/shapes/Line.js +0 -156
- package/lib/shapes/Path.d.ts +0 -50
- package/lib/shapes/Path.js +0 -670
- package/lib/shapes/Rect.d.ts +0 -11
- package/lib/shapes/Rect.js +0 -22
- package/lib/shapes/RegularPolygon.d.ts +0 -26
- package/lib/shapes/RegularPolygon.js +0 -72
- package/lib/shapes/Ring.d.ts +0 -17
- package/lib/shapes/Ring.js +0 -33
- package/lib/shapes/Sprite.d.ts +0 -32
- package/lib/shapes/Sprite.js +0 -108
- package/lib/shapes/Star.d.ts +0 -19
- package/lib/shapes/Star.js +0 -38
- package/lib/shapes/Text.d.ts +0 -90
- package/lib/shapes/Text.js +0 -461
- package/lib/shapes/TextPath.d.ts +0 -72
- package/lib/shapes/TextPath.js +0 -268
- package/lib/shapes/Transformer.d.ts +0 -130
- package/lib/shapes/Transformer.js +0 -1009
- package/lib/shapes/Wedge.d.ts +0 -19
- package/lib/shapes/Wedge.js +0 -38
- package/lib/skia-backend.d.ts +0 -2
- package/lib/skia-backend.js +0 -24
- package/lib/types.d.ts +0 -56
- package/lib/types.js +0 -21
package/package.json
CHANGED
package/lib/Animation.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Layer } from './Layer.ts';
|
|
2
|
-
import type { IFrame, AnimationFn } from './types.ts';
|
|
3
|
-
export declare class Animation {
|
|
4
|
-
func: AnimationFn;
|
|
5
|
-
id: number;
|
|
6
|
-
layers: Layer[];
|
|
7
|
-
frame: IFrame;
|
|
8
|
-
constructor(func: AnimationFn, layers?: any);
|
|
9
|
-
setLayers(layers: null | Layer | Layer[]): this;
|
|
10
|
-
getLayers(): Layer[];
|
|
11
|
-
addLayer(layer: Layer): boolean;
|
|
12
|
-
isRunning(): boolean;
|
|
13
|
-
start(): this;
|
|
14
|
-
stop(): this;
|
|
15
|
-
_updateFrameObject(time: number): void;
|
|
16
|
-
static animations: Array<Animation>;
|
|
17
|
-
static animIdCounter: number;
|
|
18
|
-
static animRunning: boolean;
|
|
19
|
-
static _addAnimation(anim: any): void;
|
|
20
|
-
static _removeAnimation(anim: any): void;
|
|
21
|
-
static _runFrames(): void;
|
|
22
|
-
static _animationLoop(): void;
|
|
23
|
-
static _handleAnimation(): void;
|
|
24
|
-
}
|
package/lib/Animation.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { glob } from "./Global.js";
|
|
2
|
-
import { Util } from "./Util.js";
|
|
3
|
-
const now = (function () {
|
|
4
|
-
if (glob.performance && glob.performance.now) {
|
|
5
|
-
return function () {
|
|
6
|
-
return glob.performance.now();
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
return function () {
|
|
10
|
-
return new Date().getTime();
|
|
11
|
-
};
|
|
12
|
-
})();
|
|
13
|
-
export class Animation {
|
|
14
|
-
constructor(func, layers) {
|
|
15
|
-
this.id = Animation.animIdCounter++;
|
|
16
|
-
this.frame = {
|
|
17
|
-
time: 0,
|
|
18
|
-
timeDiff: 0,
|
|
19
|
-
lastTime: now(),
|
|
20
|
-
frameRate: 0,
|
|
21
|
-
};
|
|
22
|
-
this.func = func;
|
|
23
|
-
this.setLayers(layers);
|
|
24
|
-
}
|
|
25
|
-
setLayers(layers) {
|
|
26
|
-
let lays = [];
|
|
27
|
-
if (layers) {
|
|
28
|
-
lays = Array.isArray(layers) ? layers : [layers];
|
|
29
|
-
}
|
|
30
|
-
this.layers = lays;
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
getLayers() {
|
|
34
|
-
return this.layers;
|
|
35
|
-
}
|
|
36
|
-
addLayer(layer) {
|
|
37
|
-
const layers = this.layers;
|
|
38
|
-
const len = layers.length;
|
|
39
|
-
for (let n = 0; n < len; n++) {
|
|
40
|
-
if (layers[n]._id === layer._id) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
this.layers.push(layer);
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
isRunning() {
|
|
48
|
-
const a = Animation;
|
|
49
|
-
const animations = a.animations;
|
|
50
|
-
const len = animations.length;
|
|
51
|
-
for (let n = 0; n < len; n++) {
|
|
52
|
-
if (animations[n].id === this.id) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
start() {
|
|
59
|
-
this.stop();
|
|
60
|
-
this.frame.timeDiff = 0;
|
|
61
|
-
this.frame.lastTime = now();
|
|
62
|
-
Animation._addAnimation(this);
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
stop() {
|
|
66
|
-
Animation._removeAnimation(this);
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
_updateFrameObject(time) {
|
|
70
|
-
this.frame.timeDiff = time - this.frame.lastTime;
|
|
71
|
-
this.frame.lastTime = time;
|
|
72
|
-
this.frame.time += this.frame.timeDiff;
|
|
73
|
-
this.frame.frameRate = 1000 / this.frame.timeDiff;
|
|
74
|
-
}
|
|
75
|
-
static _addAnimation(anim) {
|
|
76
|
-
this.animations.push(anim);
|
|
77
|
-
this._handleAnimation();
|
|
78
|
-
}
|
|
79
|
-
static _removeAnimation(anim) {
|
|
80
|
-
const id = anim.id;
|
|
81
|
-
const animations = this.animations;
|
|
82
|
-
const len = animations.length;
|
|
83
|
-
for (let n = 0; n < len; n++) {
|
|
84
|
-
if (animations[n].id === id) {
|
|
85
|
-
this.animations.splice(n, 1);
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
static _runFrames() {
|
|
91
|
-
const layerHash = {};
|
|
92
|
-
const animations = this.animations;
|
|
93
|
-
for (let n = 0; n < animations.length; n++) {
|
|
94
|
-
const anim = animations[n];
|
|
95
|
-
const layers = anim.layers;
|
|
96
|
-
const func = anim.func;
|
|
97
|
-
anim._updateFrameObject(now());
|
|
98
|
-
const layersLen = layers.length;
|
|
99
|
-
let needRedraw;
|
|
100
|
-
if (func) {
|
|
101
|
-
needRedraw = func.call(anim, anim.frame) !== false;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
needRedraw = true;
|
|
105
|
-
}
|
|
106
|
-
if (!needRedraw) {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
for (let i = 0; i < layersLen; i++) {
|
|
110
|
-
const layer = layers[i];
|
|
111
|
-
if (layer._id !== undefined) {
|
|
112
|
-
layerHash[layer._id] = layer;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
for (const key in layerHash) {
|
|
117
|
-
if (!layerHash.hasOwnProperty(key)) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
layerHash[key].batchDraw();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
static _animationLoop() {
|
|
124
|
-
const Anim = Animation;
|
|
125
|
-
if (Anim.animations.length) {
|
|
126
|
-
Anim._runFrames();
|
|
127
|
-
Util.requestAnimFrame(Anim._animationLoop);
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
Anim.animRunning = false;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
static _handleAnimation() {
|
|
134
|
-
if (!this.animRunning) {
|
|
135
|
-
this.animRunning = true;
|
|
136
|
-
Util.requestAnimFrame(this._animationLoop);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
Animation.animations = [];
|
|
141
|
-
Animation.animIdCounter = 0;
|
|
142
|
-
Animation.animRunning = false;
|
package/lib/BezierFunctions.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const tValues: number[][];
|
|
2
|
-
export declare const cValues: number[][];
|
|
3
|
-
export declare const binomialCoefficients: number[][];
|
|
4
|
-
export declare const getCubicArcLength: (xs: number[], ys: number[], t: number) => number;
|
|
5
|
-
export declare const getQuadraticArcLength: (xs: number[], ys: number[], t: number) => number;
|
|
6
|
-
export declare const t2length: (length: number, totalLength: number, func: (t: number) => number) => number;
|