next2d-development-mcp 1.4.0 → 1.6.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.
@@ -0,0 +1,210 @@
1
+ # Next2D Player - 概要・アーキテクチャ
2
+
3
+ ## 目次
4
+
5
+ 1. [概要](#next2d-player)
6
+ 2. [レンダリングパイプライン](#レンダリングパイプライン)
7
+ 3. [DisplayListアーキテクチャ](#displaylistアーキテクチャ)
8
+ 4. [基本的な使い方](#基本的な使い方)
9
+
10
+ ---
11
+
12
+ # Next2D Player
13
+
14
+ Next2D Playerは、WebGL/WebGPUを用いた高速2Dレンダリングエンジンです。Flash Playerのような機能をWeb上で実現し、ベクター描画、Tweenアニメーション、テキスト、音声、動画など、さまざまな要素をサポートしています。
15
+
16
+ ## 主な特徴
17
+
18
+ - **高速レンダリング**: WebGL/WebGPUを活用した高速2D描画
19
+ - **マルチプラットフォーム**: デスクトップからモバイルまで対応
20
+ - **豊富なフィルター**: Blur、DropShadow、Glow、Bevelなど多数のフィルターをサポート
21
+
22
+ ## レンダリングパイプライン
23
+
24
+ Next2D Playerの高速レンダリングを実現するパイプラインの全体像です。
25
+
26
+ ```mermaid
27
+ flowchart TB
28
+ %% Main Drawing Flow Chart
29
+ subgraph MainFlow["描画フローチャート - メインレンダリングパイプライン"]
30
+ direction TB
31
+
32
+ subgraph Inputs["表示オブジェクト"]
33
+ Shape["Shape<br/>(Bitmap/Vector)"]
34
+ TextField["TextField<br/>(canvas2d)"]
35
+ Video["Video Element"]
36
+ end
37
+
38
+ Shape --> MaskCheck
39
+ TextField --> MaskCheck
40
+ Video --> MaskCheck
41
+
42
+ MaskCheck{"マスク<br/>レンダリング?"}
43
+
44
+ MaskCheck -->|YES| DirectRender["直接レンダリング"]
45
+ DirectRender -->|drawArrays| FinalRender
46
+
47
+ MaskCheck -->|NO| CacheCheck1{"キャッシュ<br/>あり?"}
48
+
49
+ CacheCheck1 -->|NO| TextureAtlas["テクスチャアトラス<br/>(二分木パッキング)"]
50
+ TextureAtlas --> Coordinates
51
+
52
+ CacheCheck1 -->|YES| Coordinates["座標データベース<br/>(x, y, w, h)"]
53
+
54
+ Coordinates --> FilterBlendCheck{"フィルター or<br/>ブレンド?"}
55
+
56
+ FilterBlendCheck -->|NO| MainArrays
57
+ FilterBlendCheck -->|YES| NeedCache{"キャッシュ<br/>あり?"}
58
+
59
+ NeedCache -->|NO| CacheRender["キャッシュにレンダリング"]
60
+ CacheRender --> TextureCache
61
+ NeedCache -->|YES| TextureCache["テクスチャキャッシュ"]
62
+
63
+ TextureCache -->|drawArrays| FinalRender
64
+
65
+ MainArrays["インスタンス配列<br/>━━━━━━━━━━━━━━━<br/>matrix<br/>colorTransform<br/>Coordinates<br/>━━━━━━━━━━━━━━━<br/><b>バッチレンダリング</b>"]
66
+
67
+ MainArrays -->|drawArraysInstanced<br/><b>複数オブジェクトを1回で描画</b>| FinalRender["最終レンダリング"]
68
+
69
+ FinalRender -->|60fps| MainFramebuffer["メインフレームバッファ<br/>(ディスプレイ)"]
70
+ end
71
+
72
+ %% Branch Flow for Filter/Blend/Mask
73
+ subgraph BranchFlow["フィルター/ブレンド/マスク - 分岐処理"]
74
+ direction TB
75
+
76
+ subgraph FilterInputs["表示オブジェクト"]
77
+ Shape2["Shape<br/>(Bitmap/Vector)"]
78
+ TextField2["TextField<br/>(canvas2d)"]
79
+ Video2["Video Element"]
80
+ end
81
+
82
+ Shape2 --> CacheCheck2
83
+ TextField2 --> CacheCheck2
84
+ Video2 --> CacheCheck2
85
+
86
+ CacheCheck2{"キャッシュ<br/>あり?"}
87
+
88
+ CacheCheck2 -->|NO| EffectRender["エフェクトレンダリング"]
89
+ CacheCheck2 -->|YES| BranchArrays
90
+ EffectRender --> BranchArrays
91
+
92
+ BranchArrays["インスタンス配列<br/>━━━━━━━━━━━━━━━<br/>matrix<br/>colorTransform<br/>Coordinates<br/>━━━━━━━━━━━━━━━<br/><b>バッチレンダリング</b>"]
93
+
94
+ BranchArrays -->|drawArraysInstanced<br/><b>複数オブジェクトを1回で描画</b>| BranchRender["エフェクト結果"]
95
+
96
+ BranchRender -->|filter/blend| TextureCache
97
+ end
98
+
99
+ %% Connections between flows
100
+ FilterBlendCheck -.->|"分岐フローを<br/>トリガー"| BranchFlow
101
+ BranchArrays -.->|"レンダリング情報<br/>(座標)"| MainArrays
102
+ ```
103
+
104
+ ### パイプラインの特徴
105
+
106
+ - **バッチレンダリング**: 複数のオブジェクトを1回のGPUコールで描画
107
+ - **テクスチャキャッシュ**: フィルターやブレンド効果を効率的に処理
108
+ - **二分木パッキング**: テクスチャアトラスで最適なメモリ使用
109
+ - **60fps描画**: 高フレームレートでのスムーズなアニメーション
110
+
111
+ ## DisplayListアーキテクチャ
112
+
113
+ Next2D Playerは、Flash Playerと同様のDisplayListアーキテクチャを採用しています。
114
+
115
+ ### 主要クラス階層
116
+
117
+ ```
118
+ DisplayObject (基底クラス)
119
+ ├── InteractiveObject
120
+ │ ├── DisplayObjectContainer
121
+ │ │ ├── Sprite
122
+ │ │ ├── MovieClip
123
+ │ │ └── Stage
124
+ │ └── TextField
125
+ ├── Shape
126
+ ├── Video
127
+ └── Bitmap
128
+ ```
129
+
130
+ ### DisplayObjectContainer
131
+
132
+ 子オブジェクトを持つことができるコンテナクラス:
133
+
134
+ - `addChild(child)`: 子要素を最前面に追加
135
+ - `addChildAt(child, index)`: 指定インデックスに子要素を追加
136
+ - `removeChild(child)`: 子要素を削除
137
+ - `getChildAt(index)`: インデックスから子要素を取得
138
+ - `getChildByName(name)`: 名前から子要素を取得
139
+
140
+ ### MovieClip
141
+
142
+ タイムラインアニメーションを持つDisplayObject:
143
+
144
+ - `play()`: タイムラインを再生
145
+ - `stop()`: タイムラインを停止
146
+ - `gotoAndPlay(frame)`: 指定フレームに移動して再生
147
+ - `gotoAndStop(frame)`: 指定フレームに移動して停止
148
+ - `currentFrame`: 現在のフレーム番号
149
+ - `totalFrames`: 総フレーム数
150
+
151
+ ## 基本的な使い方
152
+
153
+ ```typescript
154
+ const { MovieClip } = next2d.display;
155
+ const { DropShadowFilter } = next2d.filters;
156
+
157
+ // ルートMovieClipを作成
158
+ const root = await next2d.createRootMovieClip(800, 600, 60, {
159
+ tagId: "container",
160
+ bgColor: "#ffffff"
161
+ });
162
+
163
+ // MovieClipの作成
164
+ const mc = new MovieClip();
165
+ root.addChild(mc);
166
+
167
+ // 位置とサイズの設定
168
+ mc.x = 100;
169
+ mc.y = 100;
170
+ mc.scaleX = 2;
171
+ mc.scaleY = 2;
172
+ mc.rotation = 45;
173
+
174
+ // フィルターの適用
175
+ mc.filters = [
176
+ new DropShadowFilter(4, 45, 0x000000, 0.5)
177
+ ];
178
+ ```
179
+
180
+ ## JSONデータの読み込み
181
+
182
+ Open Animation Toolで作成したJSONファイルを読み込んで描画:
183
+
184
+ ```typescript
185
+ const { Loader } = next2d.display;
186
+ const { URLRequest } = next2d.net;
187
+
188
+ const loader = new Loader();
189
+ await loader.load(new URLRequest("animation.json"));
190
+
191
+ // 読み込み完了後、直接contentにアクセス
192
+ const mc = loader.content;
193
+ stage.addChild(mc);
194
+ ```
195
+
196
+ ## 関連ドキュメント
197
+
198
+ ### 表示オブジェクト
199
+ - [DisplayObject](/ja/reference/player/display-object) - 全ての表示オブジェクトの基底クラス
200
+ - [MovieClip](/ja/reference/player/movie-clip) - タイムラインアニメーション
201
+ - [Sprite](/ja/reference/player/sprite) - グラフィックス描画とインタラクション
202
+ - [Shape](/ja/reference/player/shape) - 軽量なベクター描画
203
+ - [TextField](/ja/reference/player/text-field) - テキスト表示と入力
204
+ - [Video](/ja/reference/player/video) - 動画再生
205
+
206
+ ### システム
207
+ - [イベントシステム](/ja/reference/player/events) - マウス、キーボード、タッチイベント
208
+ - [フィルター](/ja/reference/player/filters) - Blur、DropShadow、Glowなど
209
+ - [サウンド](/ja/reference/player/sound) - 音声再生とサウンドエフェクト
210
+ - [Tweenアニメーション](/ja/reference/player/tween) - プログラムによるアニメーション
@@ -0,0 +1,278 @@
1
+ # Next2D Player - Tweenアニメーション
2
+
3
+ Next2D Playerでは、`@next2d/ui`パッケージのTweenシステムを使用して、プログラムによるアニメーションを実装できます。位置、サイズ、透明度などのプロパティを滑らかに変化させることができます。
4
+
5
+ ---
6
+
7
+ # Tweenの基本概念
8
+
9
+ ```mermaid
10
+ flowchart LR
11
+ Start["開始値"] -->|イージング関数| Progress["進行度 0→1"]
12
+ Progress --> End["終了値"]
13
+
14
+ subgraph Easing["イージング"]
15
+ Linear["linear"]
16
+ InQuad["inQuad"]
17
+ OutQuad["outQuad"]
18
+ InOutQuad["inOutQuad"]
19
+ end
20
+ ```
21
+
22
+ ---
23
+
24
+ # Tween.add()
25
+
26
+ `Tween.add()`メソッドでアニメーション用の`Job`インスタンスを作成します。
27
+
28
+ ```typescript
29
+ const { Tween, Easing } = next2d.ui;
30
+
31
+ const job = Tween.add(
32
+ target, // アニメーション対象オブジェクト
33
+ from, // 開始プロパティ値
34
+ to, // 終了プロパティ値
35
+ delay, // 遅延時間(秒、デフォルト: 0)
36
+ duration, // アニメーション時間(秒、デフォルト: 1)
37
+ ease // イージング関数(デフォルト: linear)
38
+ );
39
+
40
+ // アニメーションを開始
41
+ job.start();
42
+ ```
43
+
44
+ ## パラメータ
45
+
46
+ | パラメータ | 型 | デフォルト | 説明 |
47
+ |-----------|------|----------|------|
48
+ | `target` | any | - | アニメーション対象オブジェクト |
49
+ | `from` | object | - | 開始プロパティ値 |
50
+ | `to` | object | - | 終了プロパティ値 |
51
+ | `delay` | number | 0 | アニメーション開始前の遅延(秒) |
52
+ | `duration` | number | 1 | アニメーション継続時間(秒) |
53
+ | `ease` | Function \| null | null | イージング関数(デフォルトはlinear) |
54
+
55
+ ---
56
+
57
+ # Job クラス
58
+
59
+ Jobクラスは個別のアニメーションジョブを管理します。EventDispatcherを継承しています。
60
+
61
+ ## メソッド
62
+
63
+ | メソッド | 戻り値 | 説明 |
64
+ |---------|--------|------|
65
+ | `start()` | void | アニメーションを開始します |
66
+ | `stop()` | void | アニメーションを停止します |
67
+ | `chain(nextJob: Job \| null)` | Job \| null | このジョブの完了後に別のジョブを連結します |
68
+
69
+ ## プロパティ
70
+
71
+ | プロパティ | 型 | 説明 |
72
+ |-----------|------|------|
73
+ | `target` | any | 対象オブジェクト |
74
+ | `from` | object | 開始値 |
75
+ | `to` | object | 終了値 |
76
+ | `delay` | number | 遅延時間 |
77
+ | `duration` | number | 継続時間 |
78
+ | `ease` | Function | イージング関数 |
79
+ | `currentTime` | number | 現在のアニメーション時間 |
80
+ | `nextJob` | Job \| null | 次の連結ジョブ |
81
+
82
+ ## イベント
83
+
84
+ | イベント | 説明 |
85
+ |----------|------|
86
+ | `enterFrame` | 各アニメーションフレームで発行 |
87
+ | `complete` | アニメーション完了時に発行 |
88
+
89
+ ---
90
+
91
+ # イージング関数
92
+
93
+ `Easing`クラスは、11種類のイージングタイプでIn、Out、InOutのバリエーションを含む32種類のイージング関数を提供します。
94
+
95
+ | カテゴリ | 関数 |
96
+ |---------|------|
97
+ | Linear | `Easing.linear` |
98
+ | Quadratic | `Easing.inQuad` / `outQuad` / `inOutQuad` |
99
+ | Cubic | `Easing.inCubic` / `outCubic` / `inOutCubic` |
100
+ | Quartic | `Easing.inQuart` / `outQuart` / `inOutQuart` |
101
+ | Quintic | `Easing.inQuint` / `outQuint` / `inOutQuint` |
102
+ | Sinusoidal | `Easing.inSine` / `outSine` / `inOutSine` |
103
+ | Exponential | `Easing.inExpo` / `outExpo` / `inOutExpo` |
104
+ | Circular | `Easing.inCirc` / `outCirc` / `inOutCirc` |
105
+ | Elastic | `Easing.inElastic` / `outElastic` / `inOutElastic` |
106
+ | Back | `Easing.inBack` / `outBack` / `inOutBack` |
107
+ | Bounce | `Easing.inBounce` / `outBounce` / `inOutBounce` |
108
+
109
+ ---
110
+
111
+ # 使用例
112
+
113
+ ## 基本的な移動アニメーション
114
+
115
+ ```typescript
116
+ const { Tween, Easing } = next2d.ui;
117
+
118
+ const job = Tween.add(
119
+ sprite,
120
+ { x: 0, y: 100 },
121
+ { x: 400, y: 100 },
122
+ 0, 1,
123
+ Easing.outQuad
124
+ );
125
+
126
+ job.start();
127
+ ```
128
+
129
+ ## 複数プロパティの同時アニメーション
130
+
131
+ ```typescript
132
+ const { Tween, Easing } = next2d.ui;
133
+
134
+ // 移動 + 拡大 + フェードイン
135
+ const job = Tween.add(
136
+ sprite,
137
+ { x: 0, y: 0, scaleX: 1, scaleY: 1, alpha: 0 },
138
+ { x: 200, y: 150, scaleX: 2, scaleY: 2, alpha: 1 },
139
+ 0, 0.5,
140
+ Easing.outCubic
141
+ );
142
+
143
+ job.start();
144
+ ```
145
+
146
+ ## アニメーションの連結 (chain)
147
+
148
+ ```typescript
149
+ const { Tween, Easing } = next2d.ui;
150
+
151
+ const job1 = Tween.add(sprite, { x: 0 }, { x: 100 }, 0, 1, Easing.outQuad);
152
+ const job2 = Tween.add(sprite, { x: 100 }, { x: 200 }, 0, 1, Easing.inQuad);
153
+
154
+ job1.chain(job2);
155
+ job1.start();
156
+ ```
157
+
158
+ ## 遅延付きアニメーション
159
+
160
+ ```typescript
161
+ const { Tween, Easing } = next2d.ui;
162
+
163
+ // 0.5秒遅延後に1秒かけてフェードアウト
164
+ const job = Tween.add(sprite, { alpha: 1 }, { alpha: 0 }, 0.5, 1, Easing.inQuad);
165
+ job.start();
166
+ ```
167
+
168
+ ## イベントの活用
169
+
170
+ ```typescript
171
+ const { Tween, Easing } = next2d.ui;
172
+
173
+ const job = Tween.add(sprite, { x: 0 }, { x: 300 }, 0, 2, Easing.inOutQuad);
174
+
175
+ job.addEventListener("enterFrame", (event) => {
176
+ console.log("進行中:", job.currentTime);
177
+ });
178
+
179
+ job.addEventListener("complete", (event) => {
180
+ console.log("アニメーション完了!");
181
+ });
182
+
183
+ job.start();
184
+ ```
185
+
186
+ ## キャラクタージャンプ
187
+
188
+ ```typescript
189
+ const { Tween, Easing } = next2d.ui;
190
+
191
+ function jump(character) {
192
+ const startY = character.y;
193
+ const jumpHeight = 100;
194
+
195
+ const upJob = Tween.add(
196
+ character,
197
+ { y: startY },
198
+ { y: startY - jumpHeight },
199
+ 0, 0.3,
200
+ Easing.outQuad
201
+ );
202
+
203
+ const downJob = Tween.add(
204
+ character,
205
+ { y: startY - jumpHeight },
206
+ { y: startY },
207
+ 0, 0.3,
208
+ Easing.inQuad
209
+ );
210
+
211
+ upJob.chain(downJob);
212
+ upJob.start();
213
+ }
214
+ ```
215
+
216
+ ## UI表示アニメーション
217
+
218
+ ```typescript
219
+ const { Tween, Easing } = next2d.ui;
220
+
221
+ function showPopup(popup) {
222
+ popup.scaleX = 0;
223
+ popup.scaleY = 0;
224
+ popup.alpha = 0;
225
+
226
+ const job = Tween.add(
227
+ popup,
228
+ { scaleX: 0, scaleY: 0, alpha: 0 },
229
+ { scaleX: 1, scaleY: 1, alpha: 1 },
230
+ 0, 0.4,
231
+ Easing.outBack
232
+ );
233
+
234
+ job.start();
235
+ }
236
+
237
+ function hidePopup(popup) {
238
+ const job = Tween.add(
239
+ popup,
240
+ { scaleX: 1, scaleY: 1, alpha: 1 },
241
+ { scaleX: 0, scaleY: 0, alpha: 0 },
242
+ 0, 0.2,
243
+ Easing.inQuad
244
+ );
245
+
246
+ job.addEventListener("complete", () => {
247
+ popup.visible = false;
248
+ });
249
+
250
+ job.start();
251
+ }
252
+ ```
253
+
254
+ ## コイン取得エフェクト
255
+
256
+ ```typescript
257
+ const { Tween, Easing } = next2d.ui;
258
+
259
+ function coinCollectEffect(coin) {
260
+ const job = Tween.add(
261
+ coin,
262
+ { y: coin.y, alpha: 1, scaleX: 1, scaleY: 1 },
263
+ { y: coin.y - 50, alpha: 0, scaleX: 0.5, scaleY: 0.5 },
264
+ 0, 0.5,
265
+ Easing.outQuad
266
+ );
267
+
268
+ job.addEventListener("enterFrame", () => {
269
+ coin.rotation += 15;
270
+ });
271
+
272
+ job.addEventListener("complete", () => {
273
+ coin.parent?.removeChild(coin);
274
+ });
275
+
276
+ job.start();
277
+ }
278
+ ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "next2d-development-mcp",
3
3
  "displayName": "Next2D Development MCP",
4
- "version": "1.4.0",
4
+ "version": "1.6.0",
5
5
  "description": "MCP server for Next2D application development assistance",
6
6
  "type": "module",
7
7
  "author": "Toshiyuki Ienaga <ienaga@next2d.app>",
@@ -54,17 +54,17 @@
54
54
  "@eslint/js": "^10.0.1",
55
55
  "@types/node": "^25.9.3",
56
56
  "@types/vscode": "^1.120.0",
57
- "@typescript-eslint/eslint-plugin": "^8.61.0",
58
- "@typescript-eslint/parser": "^8.61.0",
57
+ "@typescript-eslint/eslint-plugin": "^8.61.1",
58
+ "@typescript-eslint/parser": "^8.61.1",
59
59
  "@vscode/vsce": "^3.9.2",
60
60
  "eslint": "^10.5.0",
61
61
  "eslint-plugin-unused-imports": "^4.4.1",
62
62
  "globals": "^17.6.0",
63
63
  "typescript": "^6.0.3",
64
- "vitest": "^4.1.8"
64
+ "vitest": "^4.1.9"
65
65
  },
66
66
  "engines": {
67
- "node": ">=22.0.0",
68
- "vscode": "^1.115.0"
67
+ "node": ">=24.0.0",
68
+ "vscode": "^1.120.0"
69
69
  }
70
70
  }