https://github.com/timeless-residents/handson-wasm-rust
Interactive canvas drawing demo using Rust and WebAssembly with real-time color effects
https://github.com/timeless-residents/handson-wasm-rust
canvas interactive-demo rust wasm webassembly
Last synced: 4 months ago
JSON representation
Interactive canvas drawing demo using Rust and WebAssembly with real-time color effects
- Host: GitHub
- URL: https://github.com/timeless-residents/handson-wasm-rust
- Owner: timeless-residents
- Created: 2025-02-10T05:16:02.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-10T05:31:34.000Z (8 months ago)
- Last Synced: 2025-05-14T02:24:06.049Z (5 months ago)
- Topics: canvas, interactive-demo, rust, wasm, webassembly
- Language: HTML
- Homepage: https://timeless-residents.github.io/handson-wasm-rust/
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WebAssembly キャンバス描画デモ
このプロジェクトは、RustとWebAssemblyを使用して作成されたインタラクティブなキャンバス描画デモアプリケーションです。
## 機能
- マウスドラッグによる描画機能
- ランダムな色の円を描画
- キャンバスのクリア機能
- スムーズな描画体験(WebAssemblyによる高速な処理)## 必要条件
- Rust(2021 Edition)
- wasm-pack
- モダンなWebブラウザ(WebAssembly対応)
- Node.js(開発サーバー用)## セットアップ
1. リポジトリをクローン:
```bash
git clone https://github.com/timeless-residents/handson-wasm-rust.git
cd handson-wasm-rust
```2. WebAssemblyにビルド:
```bash
wasm-pack build --target web
```3. ローカルサーバーで実行(例:using Python):
```bash
python -m http.server
```## 使い方
1. ブラウザで `http://localhost:8000` を開きます
2. キャンバス上でマウスをクリック&ドラッグして描画します
3. 描画中は、マウスの動きに合わせてカラフルな円が描かれます
4. 「Clear Canvas」ボタンをクリックしてキャンバスをクリアできます## プロジェクト構成
- `src/lib.rs` - Rustで実装されたキャンバス操作のコア機能
- `index.html` - WebアプリケーションのUIとJavaScriptコード
- `Cargo.toml` - Rustプロジェクトの依存関係設定## 技術スタック
- **Rust** - WebAssemblyにコンパイルされるコアロジック
- **wasm-bindgen** - RustとJavaScript間のバインディング
- **web-sys** - WebブラウザのAPIへのアクセス
- **Canvas API** - 描画機能の実装## ライセンス
このプロジェクトはMITライセンスの下で公開されています。