@next2d/player 1.14.15 → 1.14.17

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/README.md CHANGED
@@ -1,42 +1,50 @@
1
1
  Next2D Player
2
2
  =============
3
- <img src="https://next2d.app/assets/img/player/logo.svg" width="200" height="200" alt="Next2D Player Logo">
3
+ <div align="center">
4
+ <img src="https://next2d.app/assets/img/player/logo.svg" width="250" alt="Next2D Player">
5
+ </div>
4
6
 
5
7
  [![UnitTest](https://github.com/Next2D/Player/actions/workflows/integration.yml/badge.svg?branch=main)](https://github.com/Next2D/Player/actions/workflows/integration.yml)
6
8
  [![CodeQL](https://github.com/Next2D/Player/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/Next2D/Player/actions/workflows/codeql-analysis.yml)
7
9
  [![Lint](https://github.com/Next2D/Player/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/Next2D/Player/actions/workflows/lint.yml)
8
10
 
9
11
  [![release](https://img.shields.io/github/v/release/Next2D/Player)](https://github.com/Next2D/Player/releases)
10
- [![Github All Releases](https://img.shields.io/npm/dt/@next2d/player)](https://github.com/Next2D/player/releases)
12
+ [![Github All Releases](https://img.shields.io/npm/dt/@next2d/player)](https://github.com/Next2D/Player/releases)
11
13
  [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/6c9rv5Uns5)
12
14
  ![Twitter Follow](https://img.shields.io/twitter/follow/Next2D?style=social)
13
15
 
14
- [日本語](./README.ja.md) | [简体中文](./README.cn.md)
15
-
16
- ## Next2D Project
17
-
18
- ### Player
19
- Next2D Player supports WebGL and OffscreenCanvas, enabling advanced graphical expression.
20
- It can also be used in game production, advertisement production, and other scenes requiring rich expressions without having to deal with browser or device compatibility.
21
-
22
- ### NoCode Tool
23
- It is an authoring tool that runs in a Web browser and is mainly based on NoCode development. It allows users to intuitively create animations they have imagined, and the exported data can be easily uploaded to the Web and published with Player.
24
- [NoCode Tool](https://tool.next2d.app)
25
-
26
- ### Framework
27
- This framework enables scene management by URL (SPA), which has been difficult with conventional Canvas/WebGL applications, to fix development patterns and simplify readability and shareability.
28
-
29
- Please check [@Next2D](https://twitter.com/Next2D) on Twitter and the [official website](https://next2d.app) for the latest news and technical information.
30
-
16
+ [日本語]
17
+ Next2D Playerは、WebGLのハードウェアアクセラレーションでグラフィックス処理負荷を軽減し、OffscreenCanvasのマルチスレッド処理で描画パフォーマンスを向上させています。
18
+ ベクター描画、Tweenアニメーション、テキスト、音声、動画など、さまざまな要素をサポートしているので、ゲーム制作、インタラクティブなデータビジュアライゼーション、クリエイティブなウェブアプリケーションなど、豊かな表現が必要とされるプロジェクトで活用が期待できます。
19
+
20
+ [English]
21
+ Next2D Player reduces graphics processing load with WebGL hardware acceleration and improves drawing performance with OffscreenCanvas multi-threaded processing.
22
+ With support for vector rendering, tween animation, text, audio, video, and many other elements, Next2D Player can be used for game production, interactive data visualization, creative web applications, and other projects that require rich expression. The software is expected to be used in game production, interactive data visualization, creative web applications and other projects requiring rich expression.
23
+
24
+ [简体中文]
25
+ Next2D Player通过WebGL硬件加速降低了图形处理负载,通过OffscreenCanvas多线程处理提高了绘图性能。
26
+ 由于支持矢量绘图、Tween动画、文本、音频、视频和许多其他元素,它可用于游戏制作、交互式数据可视化、创意网络应用和其他需要丰富表达的项目。 该软件可用于需要丰富表现力的项目中。
27
+
28
+ ## Support
29
+ [日本語]
30
+ 最新ニュースや技術情報は、Twitterの[@Next2D](https://twitter.com/Next2D)や公式の[Website](https://next2d.app/ja/)で発信していきますので、チェックしてみてください。
31
+ Next2Dがお役に立つようでしたら、プロジェクトをご支援いただければ幸いです。
32
+
33
+ [English]
34
+ Please check [@Next2D](https://twitter.com/Next2D) on Twitter and the [official website](https://next2d.app/en/) for the latest news and technical information.
31
35
  If Next2D is useful to you, we hope you will support our project.
32
-
36
+
37
+ [简体中文]
38
+ 请在Twitter上查看[@Next2D](https://twitter.com/Next2D)和[官方网站](https://next2d.app/cn/),了解最新的新闻和技术信息。
39
+ 如果Next2D对你有用,我们希望你能支持我们的项目。
40
+
33
41
  <div align="center">
34
42
  <a href="https://github.com/sponsors/Next2D" target="_blank">
35
43
  <img src="https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86" width=180 alt="GitHub Sponsor" />
36
44
  </a>
37
45
  </div>
38
46
 
39
- ## 関連サイト
47
+ ## Related Sites
40
48
  * [Website](https://next2d.app)
41
49
  * [Player API Documentation](https://next2d.app/ja/docs/player)
42
50
  * [NoCode Tool](https://tool.next2d.app)
@@ -80,6 +88,17 @@ next2d
80
88
 
81
89
  ## Option settings
82
90
 
91
+ [日本語]
92
+
93
+ | プロパティ名 | 型 | デフォルト値 | 説明 |
94
+ |--------------|---------|---------------|-----------------------------------------------------------------------|
95
+ | `base` | string | empty | 相対パスでJSONを取得する場合、ここで設定したURLがrootとして適用されます。絶対パスの場合はここで設定したURLは適用されません。 |
96
+ | `fullScreen` | boolean | false | Stageクラスで設定した幅と高さを超えて画面全体に描画されます。 |
97
+ | `tagId` | string | empty | IDを指定すると、指定したIDのエレメント内で描画を行います。 |
98
+ | `bgColor` | string | "transparent" | 背景色を16進数で指定できます。デフォルトは無色透明です。 |
99
+
100
+ [English]
101
+
83
102
  | name | type | default | description |
84
103
  |----------------|---------|---------------|-------------------------------------------------------------------------------------------------------------------------------------|
85
104
  | `base` | string | empty | When JSON is acquired by a relative path, the URL set here is applied as root. For absolute paths, the URL set here is not applied. |
@@ -87,5 +106,15 @@ next2d
87
106
  | `tagId` | string | empty | When an ID is specified, drawing is performed within the element of the specified ID. |
88
107
  | `bgColor` | string | "transparent" | You can specify a background color in hexadecimal. The default is colorless. |
89
108
 
109
+ [简体中文]
110
+
111
+ | 名称 | 值类型 | 默认值 | 说明 |
112
+ |--------------|---------|---------------|---------------------------------------------------|
113
+ | `base` | string | empty | 当JSON是由相对路径获得的,这里设置的URL被应用为根。对于绝对路径,这里设置的URL不被应用。 |
114
+ | `fullScreen` | boolean | false | 整个屏幕的绘制超出了Stage类中设置的宽度和高度。 |
115
+ | `tagId` | string | empty | 当一个ID被指定时,在指定ID的元素内进行绘图。 |
116
+ | `bgColor` | string | "transparent" | 你可以指定一个十六进制的背景颜色。默认为无色。 |
117
+
118
+
90
119
  ## License
91
120
  This project is licensed under the [MIT License](https://opensource.org/licenses/MIT) - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,8 @@
1
+ export interface PropertyBitmapDataMessageImpl {
2
+ command: string;
3
+ sourceId: number;
4
+ width: number;
5
+ height: number;
6
+ matrix?: Float32Array;
7
+ colorTransform?: Float32Array;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -2,7 +2,7 @@
2
2
  import { $currentPlayer, $initialize, $isSafari, $rendererWorker } from "./util/Util";
3
3
  import { Next2D } from "./player/Next2D";
4
4
  if (!("next2d" in window)) {
5
- console.log("%c Next2D Player %c 1.14.15 %c https://next2d.app", "color: #fff; background: #5f5f5f", "color: #fff; background: #4bc729", "");
5
+ console.log("%c Next2D Player %c 1.14.17 %c https://next2d.app", "color: #fff; background: #5f5f5f", "color: #fff; background: #4bc729", "");
6
6
  // @ts-ignore
7
7
  window.next2d = new Next2D([new Promise((resolve) => {
8
8
  if (document.readyState === "loading") {
@@ -214,8 +214,12 @@ export class BitmapData {
214
214
  if (!context) {
215
215
  throw new Error("the context is null.");
216
216
  }
217
- // @ts-ignore
218
- context.drawImage(this._$image || this._$canvas, 0, 0);
217
+ if (this._$image) {
218
+ context.drawImage(this._$image, 0, 0);
219
+ }
220
+ if (this._$canvas) {
221
+ context.drawImage(this._$canvas, 0, 0);
222
+ }
219
223
  bitmapData.canvas = canvas;
220
224
  }
221
225
  else if (this._$buffer !== null) {
@@ -444,12 +444,6 @@ export declare class DisplayObject extends EventDispatcher {
444
444
  * @private
445
445
  */
446
446
  _$getPlaceObject(): PlaceObjectImpl | null;
447
- /**
448
- * @return {object}
449
- * @method
450
- * @private
451
- */
452
- _$sync(): any;
453
447
  /**
454
448
  * @param {object} tag
455
449
  * @param {DisplayObjectContainer} parent
@@ -3,8 +3,7 @@ import { EventDispatcher } from "../events/EventDispatcher";
3
3
  import { Transform } from "../geom/Transform";
4
4
  import { Rectangle } from "../geom/Rectangle";
5
5
  import { Point } from "../geom/Point";
6
- import { $window } from "../../util/Shortcut";
7
- import { $doUpdated, $getCurrentLoaderInfo, $getEvent, $getInstanceId } from "../../util/Global";
6
+ import { $doUpdated, $getEvent, $getInstanceId } from "../../util/Global";
8
7
  import { $currentMousePoint, $currentPlayer, $poolColorTransform, $rendererWorker, $poolMatrix, $hitContext, $variables } from "../../util/Util";
9
8
  import { $clamp, $getArray, $boundsMatrix, $Math, $poolBoundsObject, $Infinity, $getBoundsObject, $isNaN, $Deg2Rad, $Number, $Rad2Deg, $SHORT_INT_MIN, $SHORT_INT_MAX, $MATRIX_ARRAY_IDENTITY, $multiplicationMatrix, $poolFloat32Array6, $getMap, $poolMap, $getFloat32Array6 } from "../../util/RenderUtil";
10
9
  /**
@@ -1216,35 +1215,6 @@ export class DisplayObject extends EventDispatcher {
1216
1215
  }
1217
1216
  return this._$placeObject;
1218
1217
  }
1219
- /**
1220
- * @return {object}
1221
- * @method
1222
- * @private
1223
- */
1224
- _$sync() {
1225
- const name = this.namespace;
1226
- let loaderInfo = null;
1227
- if ($window.next2d.fw && $window.next2d.fw.loaderInfo.has(name)) {
1228
- loaderInfo = $window.next2d.fw.loaderInfo.get(name)._$loaderInfo;
1229
- }
1230
- if (!loaderInfo) {
1231
- loaderInfo = this._$loaderInfo || $getCurrentLoaderInfo();
1232
- }
1233
- if (!loaderInfo || !loaderInfo._$data) {
1234
- return null;
1235
- }
1236
- const characterId = loaderInfo._$data.symbols.get(name);
1237
- if (!characterId) {
1238
- return null;
1239
- }
1240
- const character = loaderInfo._$data.characters[characterId];
1241
- if (!character) {
1242
- return null;
1243
- }
1244
- this._$characterId = characterId;
1245
- this._$loaderInfo = loaderInfo;
1246
- return character;
1247
- }
1248
1218
  /**
1249
1219
  * @param {object} tag
1250
1220
  * @param {DisplayObjectContainer} parent
@@ -2,7 +2,7 @@ import { InteractiveObject } from "./InteractiveObject";
2
2
  import { Event as Next2DEvent } from "../events/Event";
3
3
  import { Rectangle } from "../geom/Rectangle";
4
4
  import { $doUpdated } from "../../util/Global";
5
- import { $currentPlayer, $getClass, $hitContext, $isTouch, $MATRIX_HIT_ARRAY_IDENTITY, $rendererWorker } from "../../util/Util";
5
+ import { $createInstance, $currentPlayer, $hitContext, $isTouch, $MATRIX_HIT_ARRAY_IDENTITY, $rendererWorker } from "../../util/Util";
6
6
  import { $boundsMatrix, $clamp, $getArray, $getBoundsObject, $getFloat32Array6, $getFloat32Array8, $getMap, $getPreObject, $Math, $COLOR_ARRAY_IDENTITY, $MATRIX_ARRAY_IDENTITY, $multiplicationColor, $multiplicationMatrix, $Number, $poolArray, $poolBoundsObject, $poolFloat32Array6, $poolFloat32Array8, $poolMap, $poolPreObject } from "../../util/RenderUtil";
7
7
  /**
8
8
  * DisplayObjectContainer クラスは、表示リストで表示オブジェクトコンテナとして機能するすべてのオブジェクトの基本クラスです。
@@ -1632,12 +1632,7 @@ export class DisplayObjectContainer extends InteractiveObject {
1632
1632
  }
1633
1633
  const character = loaderInfo._$data.characters[tag.characterId];
1634
1634
  // symbol class
1635
- if (!character.class) {
1636
- character.class = character.symbol
1637
- ? $getClass(character.symbol) || $getClass(character.extends)
1638
- : $getClass(character.extends);
1639
- }
1640
- const instance = new character.class();
1635
+ const instance = $createInstance(character.extends);
1641
1636
  instance._$build(tag, this);
1642
1637
  instance._$id = index;
1643
1638
  return instance;
@@ -5,7 +5,7 @@ import { IOErrorEvent } from "../events/IOErrorEvent";
5
5
  import { Event } from "../events/Event";
6
6
  import { ProgressEvent as Next2DProgressEvent } from "../events/ProgressEvent";
7
7
  import { HTTPStatusEvent } from "../events/HTTPStatusEvent";
8
- import { $ajax, $headerToArray, $unzipQueues, $updateUnzipWorkerStatus, $getUnzipWorker, $getClass, $currentPlayer, $useUnzipWorker } from "../../util/Util";
8
+ import { $ajax, $headerToArray, $unzipQueues, $updateUnzipWorkerStatus, $getUnzipWorker, $currentPlayer, $useUnzipWorker } from "../../util/Util";
9
9
  import { $getMap } from "../../util/RenderUtil";
10
10
  /**
11
11
  * Loader クラスは、JSON ファイルまたはイメージ(JPEG、PNG、または GIF)ファイルを読み込むために使用します。
@@ -273,14 +273,10 @@ export class Loader extends DisplayObjectContainer {
273
273
  if (!loaderInfo) {
274
274
  return;
275
275
  }
276
- let rootSymbol = null;
277
276
  const symbols = $getMap();
278
277
  if (object.symbols.length) {
279
278
  for (let idx = 0; idx < object.symbols.length; ++idx) {
280
279
  const values = object.symbols[idx];
281
- if (values[1] === 0) {
282
- rootSymbol = values[0];
283
- }
284
280
  symbols.set(values[0], values[1]);
285
281
  }
286
282
  }
@@ -290,15 +286,7 @@ export class Loader extends DisplayObjectContainer {
290
286
  "symbols": symbols
291
287
  };
292
288
  // setup
293
- if (rootSymbol) {
294
- // TODO
295
- const SymbolClass = $getClass(rootSymbol) || MovieClip;
296
- // @ts-ignore
297
- loaderInfo._$content = new SymbolClass();
298
- }
299
- else {
300
- loaderInfo._$content = new MovieClip();
301
- }
289
+ loaderInfo._$content = new MovieClip();
302
290
  // build root
303
291
  const root = object.characters[0];
304
292
  loaderInfo._$content._$build({
@@ -5,6 +5,7 @@ import type { LoopConfigImpl } from "../../../interface/LoopConfigImpl";
5
5
  import type { ParentImpl } from "../../../interface/ParentImpl";
6
6
  import type { MovieClipCharacterImpl } from "../../../interface/MovieClipCharacterImpl";
7
7
  import type { DictionaryTagImpl } from "../../../interface/DictionaryTagImpl";
8
+ import type { Character } from "../../../interface/Character";
8
9
  /**
9
10
  * MovieClip クラスは、Sprite、DisplayObjectContainer、InteractiveObject、DisplayObject
10
11
  * および EventDispatcher クラスを継承します。
@@ -290,11 +291,12 @@ export declare class MovieClip extends Sprite {
290
291
  */
291
292
  _$buildCharacter(character: MovieClipCharacterImpl): void;
292
293
  /**
293
- * @return {object}
294
+ * @param {object} character
295
+ * @return {void}
294
296
  * @method
295
297
  * @private
296
298
  */
297
- _$sync(): any;
299
+ _$sync(character: Character<MovieClipCharacterImpl>): void;
298
300
  /**
299
301
  * @param {object} tag
300
302
  * @param {DisplayObjectContainer} parent
@@ -901,16 +901,14 @@ export class MovieClip extends Sprite {
901
901
  this._$totalFrames = character.totalFrame || 1;
902
902
  }
903
903
  /**
904
- * @return {object}
904
+ * @param {object} character
905
+ * @return {void}
905
906
  * @method
906
907
  * @private
907
908
  */
908
- _$sync() {
909
- const character = super._$sync();
910
- if (character) {
911
- this._$buildCharacter(character);
912
- }
913
- return character;
909
+ _$sync(character) {
910
+ super._$sync(character);
911
+ this._$buildCharacter(character);
914
912
  }
915
913
  /**
916
914
  * @param {object} tag
@@ -7,6 +7,7 @@ import type { ParentImpl } from "../../../interface/ParentImpl";
7
7
  import type { DictionaryTagImpl } from "../../../interface/DictionaryTagImpl";
8
8
  import type { CanvasToWebGLContext } from "../../../webgl/CanvasToWebGLContext";
9
9
  import type { PlayerHitObjectImpl } from "../../../interface/PlayerHitObjectImpl";
10
+ import type { Character } from "../../../interface/Character";
10
11
  /**
11
12
  * Shape クラスには、Graphics クラスからメソッドにアクセスできる graphics プロパティがあります。
12
13
  *
@@ -94,7 +95,7 @@ export declare class Shape extends DisplayObject {
94
95
  * @method
95
96
  * @private
96
97
  */
97
- _$buildCharacter(character: ShapeCharacterImpl, loaderInfo: LoaderInfo): void;
98
+ _$buildCharacter(character: Character<ShapeCharacterImpl>, loaderInfo: LoaderInfo): void;
98
99
  /**
99
100
  * @return {void}
100
101
  * @method
@@ -102,11 +103,12 @@ export declare class Shape extends DisplayObject {
102
103
  */
103
104
  _$createWorkerInstance(): void;
104
105
  /**
105
- * @return {object}
106
+ * @param {object} character
107
+ * @return {void}
106
108
  * @method
107
109
  * @protected
108
110
  */
109
- _$sync(): ShapeCharacterImpl;
111
+ _$sync(character: ShapeCharacterImpl): void;
110
112
  /**
111
113
  * @param {object} tag
112
114
  * @param {DisplayObjectContainer} parent
@@ -309,16 +309,15 @@ export class Shape extends DisplayObject {
309
309
  $rendererWorker.postMessage(message, options);
310
310
  }
311
311
  /**
312
- * @return {object}
312
+ * @param {object} character
313
+ * @return {void}
313
314
  * @method
314
315
  * @protected
315
316
  */
316
- _$sync() {
317
- const character = super._$sync();
318
- if (character && this._$loaderInfo) {
317
+ _$sync(character) {
318
+ if (this._$loaderInfo) {
319
319
  this._$buildCharacter(character, this._$loaderInfo);
320
320
  }
321
- return character;
322
321
  }
323
322
  /**
324
323
  * @param {object} tag
@@ -152,11 +152,12 @@ export declare class Sprite extends DisplayObjectContainer {
152
152
  */
153
153
  stopDrag(): void;
154
154
  /**
155
- * @return {object}
155
+ * @param {object} character
156
+ * @return {void}
156
157
  * @method
157
158
  * @private
158
159
  */
159
- _$sync(): any;
160
+ _$sync(character: MovieClipCharacterImpl): void;
160
161
  /**
161
162
  * @param {object} tag
162
163
  * @param {DisplayObjectContainer} parent
@@ -239,22 +239,19 @@ export class Sprite extends DisplayObjectContainer {
239
239
  $dragRules.bounds = null;
240
240
  }
241
241
  /**
242
- * @return {object}
242
+ * @param {object} character
243
+ * @return {void}
243
244
  * @method
244
245
  * @private
245
246
  */
246
- _$sync() {
247
- const character = super._$sync();
247
+ _$sync(character) {
248
248
  if ($rendererWorker && this._$stage) {
249
249
  this._$createWorkerInstance();
250
250
  }
251
- if (character) {
252
- this._$controller = character.controller;
253
- this._$dictionary = character.dictionary;
254
- this._$placeMap = character.placeMap;
255
- this._$placeObjects = character.placeObjects;
256
- }
257
- return character;
251
+ this._$controller = character.controller;
252
+ this._$dictionary = character.dictionary;
253
+ this._$placeMap = character.placeMap;
254
+ this._$placeObjects = character.placeObjects;
258
255
  }
259
256
  /**
260
257
  * @param {object} tag
@@ -5,6 +5,7 @@ import type { DictionaryTagImpl } from "../../../interface/DictionaryTagImpl";
5
5
  import type { ParentImpl } from "../../../interface/ParentImpl";
6
6
  import type { CanvasToWebGLContext } from "../../../webgl/CanvasToWebGLContext";
7
7
  import type { PlayerHitObjectImpl } from "../../../interface/PlayerHitObjectImpl";
8
+ import type { Character } from "../../../interface/Character";
8
9
  /**
9
10
  * サーバーまたはローカルに保存された録画済みビデオファイルを再生する Video オブジェクトです。
10
11
  * ビデオストリームを再生するには、attachNetStream() を使用して、ビデオを Video オブジェクトに関連付けます。
@@ -257,13 +258,14 @@ export declare class Video extends DisplayObject {
257
258
  * @method
258
259
  * @private
259
260
  */
260
- _$buildCharacter(character: VideoCharacterImpl): void;
261
+ _$buildCharacter(character: Character<VideoCharacterImpl>): void;
261
262
  /**
262
- * @return {object}
263
+ * @param {object} character
264
+ * @return {void}
263
265
  * @method
264
266
  * @private
265
267
  */
266
- _$sync(): any;
268
+ _$sync(character: VideoCharacterImpl): void;
267
269
  /**
268
270
  * @param {object} tag
269
271
  * @param {DisplayObjectContainer} parent
@@ -532,16 +532,13 @@ export class Video extends DisplayObject {
532
532
  }
533
533
  }
534
534
  /**
535
- * @return {object}
535
+ * @param {object} character
536
+ * @return {void}
536
537
  * @method
537
538
  * @private
538
539
  */
539
- _$sync() {
540
- const character = super._$sync();
541
- if (character) {
542
- this._$buildCharacter(character);
543
- }
544
- return character;
540
+ _$sync(character) {
541
+ this._$buildCharacter(character);
545
542
  }
546
543
  /**
547
544
  * @param {object} tag
@@ -10,6 +10,7 @@ import type { DictionaryTagImpl } from "../../../interface/DictionaryTagImpl";
10
10
  import type { TextCharacterImpl } from "../../../interface/TextCharacterImpl";
11
11
  import type { CanvasToWebGLContext } from "../../../webgl/CanvasToWebGLContext";
12
12
  import type { PlayerHitObjectImpl } from "../../../interface/PlayerHitObjectImpl";
13
+ import type { Character } from "../../../interface/Character";
13
14
  /**
14
15
  * TextField クラスは、テキストの表示と入力用の表示オブジェクトを作成するために使用されます。
15
16
  * プロパティインスペクターを使用して、テキストフィールドにインスタンス名を付けることができます。
@@ -560,13 +561,14 @@ export declare class TextField extends InteractiveObject {
560
561
  * @method
561
562
  * @private
562
563
  */
563
- _$buildCharacter(character: TextCharacterImpl): void;
564
+ _$buildCharacter(character: Character<TextCharacterImpl>): void;
564
565
  /**
565
- * @return {object}
566
+ * @param {object} character
567
+ * @return {void}
566
568
  * @method
567
569
  * @private
568
570
  */
569
- _$sync(): any;
571
+ _$sync(character: TextCharacterImpl): void;
570
572
  /**
571
573
  * @param {object} tag
572
574
  * @param {DisplayObjectContainer} parent
@@ -1956,16 +1956,13 @@ export class TextField extends InteractiveObject {
1956
1956
  }
1957
1957
  }
1958
1958
  /**
1959
- * @return {object}
1959
+ * @param {object} character
1960
+ * @return {void}
1960
1961
  * @method
1961
1962
  * @private
1962
1963
  */
1963
- _$sync() {
1964
- const character = super._$sync();
1965
- if (character) {
1966
- this._$buildCharacter(character);
1967
- }
1968
- return character;
1964
+ _$sync(character) {
1965
+ this._$buildCharacter(character);
1969
1966
  }
1970
1967
  /**
1971
1968
  * @param {object} tag
@@ -3,6 +3,7 @@ import { ColorTransform } from "../next2d/geom/ColorTransform";
3
3
  import { URLRequestHeader } from "../next2d/net/URLRequestHeader";
4
4
  import { Player } from "../player/Player";
5
5
  import { Point } from "../next2d/geom/Point";
6
+ import type { DisplayObjectImpl } from "../../interface/DisplayObjectImpl";
6
7
  import type { Sound } from "../next2d/media/Sound";
7
8
  import type { DragRulesImpl } from "../../interface/DragRulesImpl";
8
9
  import type { AjaxOptionImpl } from "../../interface/AjaxOptionImpl";
@@ -294,12 +295,12 @@ export declare const $ajax: (option: AjaxOptionImpl) => void;
294
295
  */
295
296
  export declare const $headerToArray: (header: string) => URLRequestHeader[];
296
297
  /**
297
- * @param {string} symbol
298
- * @return {function}
298
+ * @param {string} character_extends
299
+ * @return {DisplayObject}
299
300
  * @method
300
- * @static
301
+ * @public
301
302
  */
302
- export declare const $getClass: (symbol: string) => Window | null;
303
+ export declare const $createInstance: (character_extends: string) => DisplayObjectImpl<any>;
303
304
  /**
304
305
  * @type {Worker|null}
305
306
  */
@@ -4,6 +4,11 @@ import { URLRequestHeader } from "../next2d/net/URLRequestHeader";
4
4
  import { Player } from "../player/Player";
5
5
  import { Point } from "../next2d/geom/Point";
6
6
  import { Event as Next2DEvent } from "../next2d/events/Event";
7
+ import { Sprite } from "../next2d/display/Sprite";
8
+ import { MovieClip } from "../next2d/display/MovieClip";
9
+ import { TextField } from "../next2d/text/TextField";
10
+ import { Video } from "../next2d/media/Video";
11
+ import { Shape } from "../next2d/display/Shape";
7
12
  import { $getEvent } from "./Global";
8
13
  import { $document, $window, $devicePixelRatio } from "./Shortcut";
9
14
  import { $getArray, $poolArray, $Math, $clearTimeout, $setTimeout } from "./RenderUtil";
@@ -316,15 +321,15 @@ export const $currentMousePoint = () => {
316
321
  }
317
322
  let touchX = 0;
318
323
  let touchY = 0;
319
- if (event instanceof MouseEvent) {
320
- touchX = event.pageX;
321
- touchY = event.pageY;
322
- }
323
324
  if ("changedTouches" in event) {
324
325
  const changedTouche = event.changedTouches[0];
325
326
  touchX = changedTouche.pageX;
326
327
  touchY = changedTouche.pageY;
327
328
  }
329
+ else if ("pageX" in event) {
330
+ touchX = event.pageX;
331
+ touchY = event.pageY;
332
+ }
328
333
  const pointX = (touchX - x) / player._$scale - player.x / player._$scale / $devicePixelRatio;
329
334
  const pointY = (touchY - y) / player._$scale - player.y / player._$scale / $devicePixelRatio;
330
335
  return new Point(pointX, pointY);
@@ -633,23 +638,24 @@ export const $headerToArray = (header) => {
633
638
  return results;
634
639
  };
635
640
  /**
636
- * @param {string} symbol
637
- * @return {function}
641
+ * @param {string} character_extends
642
+ * @return {DisplayObject}
638
643
  * @method
639
- * @static
644
+ * @public
640
645
  */
641
- export const $getClass = (symbol) => {
642
- const names = symbol.split(".");
643
- let object = $window;
644
- for (let idx = 0; idx < names.length; ++idx) {
645
- const name = names[idx];
646
- if (!(name in object)) {
647
- return null;
648
- }
649
- // @ts-ignore
650
- object = object[name];
646
+ export const $createInstance = (character_extends) => {
647
+ switch (character_extends) {
648
+ case MovieClip.namespace:
649
+ return new MovieClip;
650
+ case Shape.namespace:
651
+ return new Shape;
652
+ case TextField.namespace:
653
+ return new TextField();
654
+ case Sprite.namespace:
655
+ return new Sprite;
656
+ case Video.namespace:
657
+ return new Video();
651
658
  }
652
- return object;
653
659
  };
654
660
  /**
655
661
  * @type {Worker|null}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next2d/player",
3
- "version": "1.14.15",
3
+ "version": "1.14.17",
4
4
  "description": "Experience the fast and beautiful anti-aliased rendering of WebGL. You can create rich, interactive graphics, cross-platform applications and games without worrying about browser or device compatibility.",
5
5
  "author": "Toshiyuki Ienaga<ienaga@tvon.jp>",
6
6
  "license": "MIT",
package/README.cn.md DELETED
@@ -1,88 +0,0 @@
1
- Next2D Player
2
- =============
3
- <img src="https://next2d.app/assets/img/player/logo.svg" width="200" height="200" alt="Next2D Player Logo">
4
-
5
- [![UnitTest](https://github.com/Next2D/Player/actions/workflows/integration.yml/badge.svg?branch=main)](https://github.com/Next2D/Player/actions/workflows/integration.yml)
6
- [![CodeQL](https://github.com/Next2D/Player/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/Next2D/Player/actions/workflows/codeql-analysis.yml)
7
- [![Lint](https://github.com/Next2D/Player/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/Next2D/Player/actions/workflows/lint.yml)
8
-
9
- [![release](https://img.shields.io/github/v/release/Next2D/Player)](https://github.com/Next2D/Player/releases)
10
- [![Github All Releases](https://img.shields.io/npm/dt/@next2d/player)](https://github.com/Next2D/player/releases)
11
- [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/6c9rv5Uns5)
12
- ![Twitter Follow](https://img.shields.io/twitter/follow/Next2D?style=social)
13
-
14
- [English](./README.md) | [日本語](./README.ja.md)
15
-
16
- ## 下一个2D项目
17
-
18
- ### Player
19
- Next2D Player支持WebGL和OffscreenCanvas,实现了先进的图形表达。
20
- 它还可以用于游戏制作、广告制作和其他需要丰富表达的场景,而不必处理浏览器或设备的兼容性问题。
21
-
22
- ### NoCode Tool
23
- 它是一个在网络浏览器中运行的创作工具,主要基于NoCode开发。它允许用户直观地创建他们所想象的动画,导出的数据可以很容易地上传到网络上,并用播放器发布。
24
- [NoCode Tool](https://tool.next2d.app)
25
-
26
- ### Framework
27
- 这个框架可以通过URL(SPA)实现场景管理,这在传统的Canvas/WebGL应用中是很难做到的,可以固定开发模式,简化可读性和共享性。
28
-
29
- 请在Twitter上查看[@Next2D](https://twitter.com/Next2D)和[官方网站](https://next2d.app),了解最新的新闻和技术信息。
30
-
31
- 如果Next2D对你有用,我们希望你能支持我们的项目。
32
-
33
- <div align="center">
34
- <a href="https://github.com/sponsors/Next2D" target="_blank">
35
- <img src="https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86" width=180 alt="GitHub Sponsor" />
36
- </a>
37
- </div>
38
-
39
- ## 関連サイト
40
- * [Website](https://next2d.app)
41
- * [Player API Documentation](https://next2d.app/ja/docs/player)
42
- * [NoCode Tool](https://tool.next2d.app)
43
- * [Framework](https://github.com/Next2D/framework)
44
-
45
- ## Examples
46
-
47
- ### 使用简单的样本
48
- ```javascript
49
- next2d.load("JSON Path...");
50
- ```
51
- [CodePen](https://codepen.io/next2d/pen/rNGMrZG)
52
-
53
- ### 使用程序样本
54
-
55
- ```javascript
56
- const { Loader } = next2d.display;
57
- const { URLRequest } = next2d.net;
58
- const { Event } = next2d.events;
59
-
60
- // create root MovieClip
61
- const root = next2d.createRootMovieClip();
62
-
63
- const request = new URLRequest("JSON path");
64
- const loader = new Loader(request);
65
-
66
- loader
67
- .contentLoaderInfo
68
- .addEventListener(Event.COMPLETE, (event) =>
69
- {
70
- root.addChild(event.currentTarget.content);
71
- });
72
-
73
- loader.load(request);
74
- ```
75
- [CodePen](https://codepen.io/next2d/pen/VwMKGEv)\
76
- @see [API 文档](https://next2d.app/cn/docs/player)
77
-
78
- ## 设置选项
79
-
80
- | 名称 | 值类型 | 默认值 | 说明 |
81
- |--------------|---------|---------------|---------------------------------------------------|
82
- | `base` | string | empty | 当JSON是由相对路径获得的,这里设置的URL被应用为根。对于绝对路径,这里设置的URL不被应用。 |
83
- | `fullScreen` | boolean | false | 整个屏幕的绘制超出了Stage类中设置的宽度和高度。 |
84
- | `tagId` | string | empty | 当一个ID被指定时,在指定ID的元素内进行绘图。 |
85
- | `bgColor` | string | "transparent" | 你可以指定一个十六进制的背景颜色。默认为无色。 |
86
-
87
- ## 许可证
88
- 本项目使用 [MIT License](https://opensource.org/licenses/MIT) 许可证 - 参考 [LICENSE](LICENSE) 文件了解许可证内容。
package/README.ja.md DELETED
@@ -1,88 +0,0 @@
1
- Next2D Player
2
- =============
3
- <img src="https://next2d.app/assets/img/player/logo.svg" width="200" height="200" alt="Next2D Player Logo">
4
-
5
- [![UnitTest](https://github.com/Next2D/Player/actions/workflows/integration.yml/badge.svg?branch=main)](https://github.com/Next2D/Player/actions/workflows/integration.yml)
6
- [![CodeQL](https://github.com/Next2D/Player/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/Next2D/Player/actions/workflows/codeql-analysis.yml)
7
- [![Lint](https://github.com/Next2D/Player/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/Next2D/Player/actions/workflows/lint.yml)
8
-
9
- [![release](https://img.shields.io/github/v/release/Next2D/Player)](https://github.com/Next2D/Player/releases)
10
- [![Github All Releases](https://img.shields.io/npm/dt/@next2d/player)](https://github.com/Next2D/player/releases)
11
- [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/6c9rv5Uns5)
12
- ![Twitter Follow](https://img.shields.io/twitter/follow/Next2D?style=social)
13
-
14
- ## Next2Dプロジェクト
15
-
16
- ### Player
17
- Next2D Playerは、WebGL、OffscreenCanvasをサポートしており、高度なグラフィカル表現が可能です。
18
- また、ブラウザやデバイスの互換性に対処したりすることなく、ゲーム制作・広告制作など豊かな表現が必要とされるシーンで利用できると思います。
19
-
20
- ### NoCode Tool
21
- Webブラウザ上で動作する、NoCode開発を主体としたオーサリングツールで、イメージしたアニメーションを直感的に作成でき、書き出したデータはWebにアップロードしてPlayerで簡単に公開できます。
22
- [NoCode Tool](https://tool.next2d.app)
23
-
24
- ### Framework
25
- 従来のCanvas/WebGLアプリケーションでは困難だったURLによるシーン管理(SPA)を可能にし、開発パターンを固定化し、可読性・共有性を簡素化するフレームワークです。
26
-
27
- 最新ニュースや技術情報は、Twitterの[@Next2D](https://twitter.com/Next2D)や公式の[Website](https://next2d.app)で発信していきますので、チェックしてみてください。
28
-
29
- Next2Dがお役に立つようでしたら、プロジェクトをご支援いただければ幸いです。
30
-
31
- <div align="center">
32
- <a href="https://github.com/sponsors/Next2D" target="_blank">
33
- <img src="https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86" width=180 alt="GitHub Sponsor" />
34
- </a>
35
- </div>
36
-
37
- [English](./README.md) | [简体中文](./README.cn.md)
38
-
39
- ## 関連サイト
40
- * [Website](https://next2d.app)
41
- * [Player API Documentation](https://next2d.app/ja/docs/player)
42
- * [NoCode Tool](https://tool.next2d.app)
43
- * [Framework](https://github.com/Next2D/framework)
44
-
45
- ## Examples
46
-
47
- ### シンプルプログラム
48
- ```javascript
49
- next2d.load("JSON Path...");
50
- ```
51
-
52
- [CodePen](https://codepen.io/next2d/pen/rNGMrZG)
53
-
54
- ### プログラムサンプル
55
- ```javascript
56
- const { Loader } = next2d.display;
57
- const { URLRequest } = next2d.net;
58
- const { Event } = next2d.events;
59
-
60
- // create root MovieClip
61
- const root = next2d.createRootMovieClip();
62
-
63
- const request = new URLRequest("JSON path");
64
- const loader = new Loader(request);
65
-
66
- loader
67
- .contentLoaderInfo
68
- .addEventListener(Event.COMPLETE, (event) =>
69
- {
70
- root.addChild(event.currentTarget.content);
71
- });
72
-
73
- loader.load(request);
74
- ```
75
- [CodePen](https://codepen.io/next2d/pen/VwMKGEv)\
76
- @see [Player API Documentation](https://next2d.app/ja/docs/player)
77
-
78
- ## オプション設定
79
-
80
- | プロパティ名 | 型 | デフォルト値 | 説明 |
81
- |--------------|---------|---------------|-----------------------------------------------------------------------|
82
- | `base` | string | empty | 相対パスでJSONを取得する場合、ここで設定したURLがrootとして適用されます。絶対パスの場合はここで設定したURLは適用されません。 |
83
- | `fullScreen` | boolean | false | Stageクラスで設定した幅と高さを超えて画面全体に描画されます。 |
84
- | `tagId` | string | empty | IDを指定すると、指定したIDのエレメント内で描画を行います。 |
85
- | `bgColor` | string | "transparent" | 背景色を16進数で指定できます。デフォルトは無色透明です。 |
86
-
87
- ## License
88
- This project is licensed under the [MIT License](https://opensource.org/licenses/MIT) - see the [LICENSE](LICENSE) file for details.