@next2d/display 1.14.20
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/README.md +11 -0
- package/dist/BitmapData.d.ts +142 -0
- package/dist/BitmapData.js +386 -0
- package/dist/BlendMode.d.ts +204 -0
- package/dist/BlendMode.js +240 -0
- package/dist/DisplayObject.d.ts +556 -0
- package/dist/DisplayObject.js +1671 -0
- package/dist/DisplayObjectContainer.d.ts +346 -0
- package/dist/DisplayObjectContainer.js +1775 -0
- package/dist/FrameLabel.d.ts +98 -0
- package/dist/FrameLabel.js +120 -0
- package/dist/Graphics.d.ts +571 -0
- package/dist/Graphics.js +2164 -0
- package/dist/GraphicsBitmapFill.d.ts +49 -0
- package/dist/GraphicsBitmapFill.js +86 -0
- package/dist/GraphicsGradientFill.d.ts +65 -0
- package/dist/GraphicsGradientFill.js +157 -0
- package/dist/InteractiveObject.d.ts +32 -0
- package/dist/InteractiveObject.js +43 -0
- package/dist/Loader.d.ts +130 -0
- package/dist/Loader.js +318 -0
- package/dist/LoaderInfo.d.ts +120 -0
- package/dist/LoaderInfo.js +184 -0
- package/dist/LoopConfig.d.ts +108 -0
- package/dist/LoopConfig.js +156 -0
- package/dist/LoopType.d.ts +104 -0
- package/dist/LoopType.js +122 -0
- package/dist/MovieClip.d.ts +310 -0
- package/dist/MovieClip.js +940 -0
- package/dist/Shape.d.ts +164 -0
- package/dist/Shape.js +509 -0
- package/dist/Sprite.d.ts +170 -0
- package/dist/Sprite.js +280 -0
- package/dist/Stage.d.ts +164 -0
- package/dist/Stage.js +251 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17 -0
- package/package.json +45 -0
package/dist/Stage.js
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { DisplayObjectContainer } from "./DisplayObjectContainer";
|
|
2
|
+
import { $devicePixelRatio } from "@next2d/util";
|
|
3
|
+
import { $clamp, $toColorInt, $uintToRGBA } from "@next2d/share";
|
|
4
|
+
/**
|
|
5
|
+
* Stage クラスはメイン描画領域を表します。
|
|
6
|
+
* The Stage class represents the main drawing area.
|
|
7
|
+
*
|
|
8
|
+
* @class
|
|
9
|
+
* @memberOf next2d.display
|
|
10
|
+
* @extends DisplayObjectContainer
|
|
11
|
+
*/
|
|
12
|
+
export class Stage extends DisplayObjectContainer {
|
|
13
|
+
/**
|
|
14
|
+
* @constructor
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
/**
|
|
20
|
+
* @type {Player}
|
|
21
|
+
* @default null
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
this._$player = null;
|
|
25
|
+
/**
|
|
26
|
+
* @type {Stage}
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
this._$root = this;
|
|
30
|
+
/**
|
|
31
|
+
* @type {Stage}
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
this._$stage = this;
|
|
35
|
+
/**
|
|
36
|
+
* @type {boolean}
|
|
37
|
+
* @default true
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
this._$invalidate = true;
|
|
41
|
+
/**
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @default 0xffffffff
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
this._$color = 0xffffffff;
|
|
47
|
+
/**
|
|
48
|
+
* @type {number}
|
|
49
|
+
* @default 60
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
this._$frameRate = 60;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @description 指定されたクラスのストリングを返します。
|
|
56
|
+
* Returns the string representation of the specified class.
|
|
57
|
+
*
|
|
58
|
+
* @return {string}
|
|
59
|
+
* @default [class Stage]
|
|
60
|
+
* @method
|
|
61
|
+
* @static
|
|
62
|
+
*/
|
|
63
|
+
static toString() {
|
|
64
|
+
return "[class Stage]";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @description 指定されたクラスの空間名を返します。
|
|
68
|
+
* Returns the space name of the specified class.
|
|
69
|
+
*
|
|
70
|
+
* @return {string}
|
|
71
|
+
* @default next2d.display.Stage
|
|
72
|
+
* @const
|
|
73
|
+
* @static
|
|
74
|
+
*/
|
|
75
|
+
static get namespace() {
|
|
76
|
+
return "next2d.display.Stage";
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @description 指定されたオブジェクトのストリングを返します。
|
|
80
|
+
* Returns the string representation of the specified object.
|
|
81
|
+
*
|
|
82
|
+
* @return {string}
|
|
83
|
+
* @default [object Stage]
|
|
84
|
+
* @method
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
toString() {
|
|
88
|
+
return "[object Stage]";
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @description 指定されたオブジェクトの空間名を返します。
|
|
92
|
+
* Returns the space name of the specified object.
|
|
93
|
+
*
|
|
94
|
+
* @return {string}
|
|
95
|
+
* @default next2d.display.Stage
|
|
96
|
+
* @const
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
get namespace() {
|
|
100
|
+
return "next2d.display.Stage";
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @description 背景色です。
|
|
104
|
+
* background color.
|
|
105
|
+
*
|
|
106
|
+
* @member {number}
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
get color() {
|
|
110
|
+
return this._$color;
|
|
111
|
+
}
|
|
112
|
+
set color(color) {
|
|
113
|
+
this._$color = $clamp($toColorInt(color), 0, 0xffffff, 0xffffff);
|
|
114
|
+
const player = this._$player;
|
|
115
|
+
if (player && player.context) {
|
|
116
|
+
const rgba = $uintToRGBA(this._$color);
|
|
117
|
+
player
|
|
118
|
+
.context
|
|
119
|
+
._$setColor(rgba.R / 255, rgba.G / 255, rgba.B / 255, rgba.A / 255);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @description ステージのフレームレートを取得または設定します。
|
|
124
|
+
* Gets and sets the frame rate of the stage.
|
|
125
|
+
*
|
|
126
|
+
* @member {number}
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
get frameRate() {
|
|
130
|
+
return this._$frameRate;
|
|
131
|
+
}
|
|
132
|
+
set frameRate(frame_rate) {
|
|
133
|
+
this._$frameRate = $clamp(+frame_rate, 1, 60, 60);
|
|
134
|
+
if (this._$player && !this._$player._$stopFlag) {
|
|
135
|
+
this._$player.stop();
|
|
136
|
+
this._$player.play();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* @description Player オブジェクトを返します。
|
|
141
|
+
* Returns a Player object.
|
|
142
|
+
*
|
|
143
|
+
* @member {Player}
|
|
144
|
+
* @readonly
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
get player() {
|
|
148
|
+
return this._$player;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* @description 現在のCanvasの高さをピクセル単位で指定します。
|
|
152
|
+
* Specifies the height of the current Canvas in pixels.
|
|
153
|
+
*
|
|
154
|
+
* @member {number}
|
|
155
|
+
* @readonly
|
|
156
|
+
* @public
|
|
157
|
+
*/
|
|
158
|
+
get canvasHeight() {
|
|
159
|
+
return this._$player
|
|
160
|
+
? this._$player._$height / $devicePixelRatio
|
|
161
|
+
: 0;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* @description 現在のCanvasの幅をピクセル単位で指定します。
|
|
165
|
+
* Specifies the width of the current Canvas in pixels.
|
|
166
|
+
*
|
|
167
|
+
* @member {number}
|
|
168
|
+
* @readonly
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
171
|
+
get canvasWidth() {
|
|
172
|
+
return this._$player
|
|
173
|
+
? this._$player._$width / $devicePixelRatio
|
|
174
|
+
: 0;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @description 現在のStageの高さをピクセル単位で指定します。
|
|
178
|
+
* Specifies the height of the current Stage in pixels.
|
|
179
|
+
*
|
|
180
|
+
* @member {number}
|
|
181
|
+
* @readonly
|
|
182
|
+
* @public
|
|
183
|
+
*/
|
|
184
|
+
get currentStageHeight() {
|
|
185
|
+
return this._$player
|
|
186
|
+
? this._$player.height * this._$player._$scale
|
|
187
|
+
: 0;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* @description 現在のStageの幅をピクセル単位で指定します。
|
|
191
|
+
* Specifies the width of the current Stage in pixels.
|
|
192
|
+
*
|
|
193
|
+
* @member {number}
|
|
194
|
+
* @readonly
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
197
|
+
get currentStageWidth() {
|
|
198
|
+
return this._$player
|
|
199
|
+
? this._$player.width * this._$player._$scale
|
|
200
|
+
: 0;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* @description 初期設定したステージの高さをピクセル単位で指定します。
|
|
204
|
+
* Specifies the height of the initially set stage in pixels.
|
|
205
|
+
*
|
|
206
|
+
* @member {number}
|
|
207
|
+
* @readonly
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
210
|
+
get stageHeight() {
|
|
211
|
+
return this._$player ? this._$player.height : 0;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @description 初期設定したステージの幅をピクセル単位で指定します。
|
|
215
|
+
* Specifies the width of the initially set stage in pixels.
|
|
216
|
+
*
|
|
217
|
+
* @member {number}
|
|
218
|
+
* @readonly
|
|
219
|
+
* @public
|
|
220
|
+
*/
|
|
221
|
+
get stageWidth() {
|
|
222
|
+
return this._$player ? this._$player.width : 0;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* @description 表示リストをレンダリングする必要のある次の機会に、
|
|
226
|
+
* 表示オブジェクトに警告するようランタイムに通知します。
|
|
227
|
+
* (例えば、再生ヘッドを新しいフレームに進める場合などです。)
|
|
228
|
+
* Calling the invalidate() method signals runtimes
|
|
229
|
+
* to alert display objects on the next opportunity
|
|
230
|
+
* it has to render the display list.
|
|
231
|
+
* (for example, when the playhead advances to a new frame)
|
|
232
|
+
*
|
|
233
|
+
* @return {void}
|
|
234
|
+
* @method
|
|
235
|
+
* @public
|
|
236
|
+
*/
|
|
237
|
+
invalidate() {
|
|
238
|
+
this._$invalidate = true;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* @param {DisplayObject} child
|
|
242
|
+
* @return {DisplayObject}
|
|
243
|
+
* @method
|
|
244
|
+
* @private
|
|
245
|
+
*/
|
|
246
|
+
_$addChild(child) {
|
|
247
|
+
child._$stage = this;
|
|
248
|
+
child._$root = child;
|
|
249
|
+
return super._$addChild(child);
|
|
250
|
+
}
|
|
251
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./BitmapData";
|
|
2
|
+
export * from "./BlendMode";
|
|
3
|
+
export * from "./DisplayObject";
|
|
4
|
+
export * from "./DisplayObjectContainer";
|
|
5
|
+
export * from "./FrameLabel";
|
|
6
|
+
export * from "./Graphics";
|
|
7
|
+
export * from "./GraphicsBitmapFill";
|
|
8
|
+
export * from "./GraphicsGradientFill";
|
|
9
|
+
export * from "./InteractiveObject";
|
|
10
|
+
export * from "./Loader";
|
|
11
|
+
export * from "./LoaderInfo";
|
|
12
|
+
export * from "./LoopConfig";
|
|
13
|
+
export * from "./LoopType";
|
|
14
|
+
export * from "./MovieClip";
|
|
15
|
+
export * from "./Shape";
|
|
16
|
+
export * from "./Sprite";
|
|
17
|
+
export * from "./Stage";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./BitmapData";
|
|
2
|
+
export * from "./BlendMode";
|
|
3
|
+
export * from "./DisplayObject";
|
|
4
|
+
export * from "./DisplayObjectContainer";
|
|
5
|
+
export * from "./FrameLabel";
|
|
6
|
+
export * from "./Graphics";
|
|
7
|
+
export * from "./GraphicsBitmapFill";
|
|
8
|
+
export * from "./GraphicsGradientFill";
|
|
9
|
+
export * from "./InteractiveObject";
|
|
10
|
+
export * from "./Loader";
|
|
11
|
+
export * from "./LoaderInfo";
|
|
12
|
+
export * from "./LoopConfig";
|
|
13
|
+
export * from "./LoopType";
|
|
14
|
+
export * from "./MovieClip";
|
|
15
|
+
export * from "./Shape";
|
|
16
|
+
export * from "./Sprite";
|
|
17
|
+
export * from "./Stage";
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@next2d/display",
|
|
3
|
+
"version": "1.14.20",
|
|
4
|
+
"description": "Next2D Display Packages",
|
|
5
|
+
"author": "Toshiyuki Ienaga<ienaga@tvon.jp> (https://github.com/ienaga/)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://next2d.app",
|
|
8
|
+
"bugs": "https://github.com/Next2D/Player/issues",
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"Next2D",
|
|
28
|
+
"Next2D Display"
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/Next2D/Player.git"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@next2d/interface": "1.14.20",
|
|
36
|
+
"@next2d/core": "1.14.20",
|
|
37
|
+
"@next2d/geom": "1.14.20",
|
|
38
|
+
"@next2d/util": "1.14.20",
|
|
39
|
+
"@next2d/share": "1.14.20",
|
|
40
|
+
"@next2d/webgl": "1.14.20",
|
|
41
|
+
"@next2d/media": "1.14.20",
|
|
42
|
+
"@next2d/net": "1.14.20",
|
|
43
|
+
"@next2d/events": "1.14.20"
|
|
44
|
+
}
|
|
45
|
+
}
|