Skip to content

Comments

各種ドキュメントを更新#251

Merged
ienaga merged 3 commits intomainfrom
develop
Feb 11, 2026
Merged

各種ドキュメントを更新#251
ienaga merged 3 commits intomainfrom
develop

Conversation

@ienaga
Copy link
Member

@ienaga ienaga commented Feb 11, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 11, 2026 01:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

マルチ言語(ja/en/cn)の仕様ドキュメントと各パッケージREADMEを更新し、Next2D Player の最新API(PointerEvent / Tween(Job) / WebGPU 等)に合わせた記述へ整備するPRです。あわせてルートのバージョンを 3.0.1 に更新しています。

Changes:

  • クリック/マウス系の例を PointerEvent 定数(POINTER_DOWN/UP 等)ベースの例へ更新
  • Tweenドキュメントを Tween.add()Job 中心の記述へ刷新し、Easing一覧も現行命名に追従
  • WebGPU/Filters/Display/ルートREADMEや開発ドキュメント(依存関係ルール)を更新、package.json を 3.0.1 に更新

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
specs/ja/video.md Video例をPointerEvent/VideoEvent(events側)に合わせて更新
specs/ja/tween.md Tween.add()/Job中心へ刷新、Easing命名更新
specs/ja/sprite.md ボタン/ドラッグ例をPointerEventへ更新
specs/ja/shape.md Bitmap Fill例をShape.load()/bitmapData利用へ更新
specs/ja/movie-clip.md 再生トグル例をPointerEventへ更新
specs/ja/events.md DOM風3フェーズ記述、Pointer/Keyboard等の定数表を拡充
specs/en/video.md TypeScript化+PointerEvent/VideoEvent例の追加・整理
specs/en/tween.md Tween.add()/Job中心へ刷新、Easing説明を拡充
specs/en/sprite.md 例をTypeScript化+PointerEventへ更新
specs/en/shape.md Bitmap Fill例をShape.load()/bitmapData利用へ更新
specs/en/movie-clip.md 例をTypeScript化+PointerEventへ更新
specs/en/events.md DOM風3フェーズ記述、Pointer/Keyboard等の定数表を拡充
specs/cn/video.md TypeScript化+PointerEvent/VideoEvent例の追加・整理
specs/cn/tween.md Tween.add()/Job中心へ刷新、Easing説明を拡充
specs/cn/sprite.md 例をTypeScript化+PointerEventへ更新
specs/cn/shape.md Bitmap Fill例をShape.load()/bitmapData利用へ更新
specs/cn/movie-clip.md 例をTypeScript化+PointerEventへ更新
specs/cn/events.md DOM风3阶段记述、Pointer/Keyboard等常量表扩充
packages/webgpu/README.md WebGPUバックエンドREADMEを再構成(概要/構成/パイプライン等)
packages/filters/README.md WebGL/WebGPU両対応の記述に更新
packages/display/README.md TextField/Videoの所在整理(text/media側に含む旨を明確化)
package.json バージョンを 3.0.1 に更新
README.md ルートREADMEのWebGL→WebGL/WebGPU記述更新
DEVELOP.md rendererがimport可能なbackendにwebgpuを追加

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +84 to +85
| `enterFrame` | 每个动画帧触发 |
| `complete` | 动画完成时触发 |
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job 事件表中写了 enterFrame / complete,但 @next2d/eventsJobEvent 目前只提供 UPDATE("jobupdate")和 STOP("jobstop")等作业事件类型。请将此表更新为实际可订阅的事件。

Suggested change
| `enterFrame` | 每个动画帧触发 |
| `complete` | 动画完成时触发 |
| `jobupdate` | 每次作业更新时触发(通常为每帧) |
| `jobstop` | 作业停止时触发(包括正常结束或手动停止) |

Copilot uses AI. Check for mistakes.
Comment on lines +134 to 149
```typescript
const { Loader } = next2d.display;
const { URLRequest } = next2d.net;

const loader = new Loader();

loader.contentLoaderInfo.addEventListener("complete", function(event) {
const content = event.currentTarget.content;
stage.addChild(content);
});
// Loading with async/await
await loader.load(new URLRequest("animation.json"));
const content = loader.content;
stage.addChild(content);

loader.contentLoaderInfo.addEventListener("progress", function(event) {
// Using progress events
loader.contentLoaderInfo.addEventListener("progress", (event) => {
const percent = (event.bytesLoaded / event.bytesTotal) * 100;
console.log(percent + "% loaded");
console.log(`${percent}% loaded`);
});
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this sample, await loader.load(...) completes before the progress listener is attached, so no progress events can be observed. Either register progress before calling load(), or split this into two separate examples (async/await vs progress events).

Copilot uses AI. Check for mistakes.
Comment on lines +134 to 149
```typescript
const { Loader } = next2d.display;
const { URLRequest } = next2d.net;

const loader = new Loader();

loader.contentLoaderInfo.addEventListener("complete", function(event) {
const content = event.currentTarget.content;
stage.addChild(content);
});
// 使用 async/await 加载
await loader.load(new URLRequest("animation.json"));
const content = loader.content;
stage.addChild(content);

loader.contentLoaderInfo.addEventListener("progress", function(event) {
// 使用进度事件
loader.contentLoaderInfo.addEventListener("progress", (event) => {
const percent = (event.bytesLoaded / event.bytesTotal) * 100;
console.log(percent + "% 已加载");
console.log(`${percent}% 已加载`);
});
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该示例中先 await loader.load(...),随后才注册 progress 监听器,因此无法收到进度事件。请在调用 load() 前先注册监听器,或将 async/await 示例与 progress 示例拆分为两个独立示例。

Copilot uses AI. Check for mistakes.
Comment on lines +179 to 191
```typescript
const { Video } = next2d.media;

const video = new Video(640, 360);
video.src = "video.mp4";
video.volume = 0.5; // 50%
stage.addChild(video);

// Volume slider
volumeSlider.addEventListener("change", function(event) {
video.volume = event.target.value; // 0.0 ~ 1.0
});
stage.addChild(video);

// Mute toggle
let isMuted = false;
let previousVolume = 0.5;

muteButton.addEventListener("click", function() {
isMuted = !isMuted;
if (isMuted) {
previousVolume = video.volume;
video.volume = 0;
} else {
video.volume = previousVolume;
}
muteButton.addEventListener(PointerEvent.POINTER_DOWN, () => {
video.muted = !video.muted;
});
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block uses PointerEvent.POINTER_DOWN, but PointerEvent is never imported in the block. Add const { PointerEvent } = next2d.events; (or avoid the constant) so the snippet is self-contained TypeScript.

Copilot uses AI. Check for mistakes.
Comment on lines +179 to 191
```typescript
const { Video } = next2d.media;

const video = new Video(640, 360);
video.src = "video.mp4";
video.volume = 0.5; // 50%
stage.addChild(video);

// 音量滑块
volumeSlider.addEventListener("change", function(event) {
video.volume = event.target.value; // 0.0 ~ 1.0
});
stage.addChild(video);

// 静音切换
let isMuted = false;
let previousVolume = 0.5;

muteButton.addEventListener("click", function() {
isMuted = !isMuted;
if (isMuted) {
previousVolume = video.volume;
video.volume = 0;
} else {
video.volume = previousVolume;
}
muteButton.addEventListener(PointerEvent.POINTER_DOWN, () => {
video.muted = !video.muted;
});
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该代码块里使用了 PointerEvent.POINTER_DOWN,但没有在同一代码块中引入 PointerEvent。请补充 const { PointerEvent } = next2d.events;,确保示例可直接运行。

Copilot uses AI. Check for mistakes.
Comment on lines +239 to +247
// Per-frame processing
job.addEventListener("enterFrame", (event) => {
console.log("Progress:", job.currentTime);
});

setTimeout(shake, 50);
}
// On completion
job.addEventListener("complete", (event) => {
console.log("Animation complete!");
});
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example listens to "enterFrame" and "complete", but Job dispatches job-specific events via JobEvent (e.g., JobEvent.UPDATE, JobEvent.STOP). As written, the snippet won't fire. Please import JobEvent and use those constants (or document the correct emitted event names).

Copilot uses AI. Check for mistakes.
```javascript
const { Sprite } = next2d.display;
```typescript
const { Tween, Easing } = next2d.ui;
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example uses new Sprite() but no longer imports Sprite (the snippet only imports Tween/Easing). Add const { Sprite } = next2d.display; (or otherwise define Sprite) so the sample is runnable.

Suggested change
const { Tween, Easing } = next2d.ui;
const { Tween, Easing } = next2d.ui;
const { Sprite } = next2d.display;

Copilot uses AI. Check for mistakes.
```javascript
const { Sprite } = next2d.display;
```typescript
const { Tween, Easing } = next2d.ui;
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该示例中使用了 new Sprite(),但代码块里已不再引入 Sprite(只引入了 Tween/Easing)。请补充 const { Sprite } = next2d.display;(或其他方式定义 Sprite),保证示例可直接运行。

Suggested change
const { Tween, Easing } = next2d.ui;
const { Tween, Easing } = next2d.ui;
const { Sprite } = next2d.display;

Copilot uses AI. Check for mistakes.
Comment on lines +353 to +369
```typescript
const { Tween, Easing } = next2d.ui;

const cy = 3 * y1;
const by = 3 * (y2 - y1) - cy;
const ay = 1 - cy - by;
const job = Tween.add(
sprite,
{ x: 0 },
{ x: 400 },
0, 2,
Easing.linear
);

function sampleCurveY(t) {
return ((ay * t + by) * t + cy) * t;
}
job.start();

return sampleCurveY(t);
};
}

// CSS cubic-bezier equivalent
const customEase = bezierEasing(0.25, 0.1, 0.25, 1.0);
// Stop midway
stopButton.addEventListener(PointerEvent.POINTER_DOWN, () => {
job.stop();
});
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet uses PointerEvent.POINTER_DOWN, but PointerEvent is not imported in the code block. Add const { PointerEvent } = next2d.events; so the example compiles as TypeScript.

Copilot uses AI. Check for mistakes.
Comment on lines +353 to +369
```typescript
const { Tween, Easing } = next2d.ui;

const cy = 3 * y1;
const by = 3 * (y2 - y1) - cy;
const ay = 1 - cy - by;
const job = Tween.add(
sprite,
{ x: 0 },
{ x: 400 },
0, 2,
Easing.linear
);

function sampleCurveY(t) {
return ((ay * t + by) * t + cy) * t;
}
job.start();

return sampleCurveY(t);
};
}

// CSS cubic-bezier 等效
const customEase = bezierEasing(0.25, 0.1, 0.25, 1.0);
// 中途停止
stopButton.addEventListener(PointerEvent.POINTER_DOWN, () => {
job.stop();
});
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该示例里使用了 PointerEvent.POINTER_DOWN,但代码块中未引入 PointerEvent。请补充 const { PointerEvent } = next2d.events; 以保证 TypeScript 示例可直接编译运行。

Copilot uses AI. Check for mistakes.
@ienaga ienaga merged commit 6bb173c into main Feb 11, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant