@series-inc/rundot-3d-engine 0.3.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.
- package/LICENSE.txt +6 -0
- package/README.md +80 -0
- package/dist/ComponentRegistry-V_7WauAE.d.ts +448 -0
- package/dist/chunk-ZNDJR3RD.js +5623 -0
- package/dist/chunk-ZNDJR3RD.js.map +1 -0
- package/dist/index.d.ts +1484 -0
- package/dist/index.js +1390 -0
- package/dist/index.js.map +1 -0
- package/dist/systems/index.d.ts +3356 -0
- package/dist/systems/index.js +9652 -0
- package/dist/systems/index.js.map +1 -0
- package/docs/core/Component.md +321 -0
- package/docs/core/GameObject.md +204 -0
- package/docs/core/VenusGame.md +316 -0
- package/docs/patterns/ComponentCommunication.md +337 -0
- package/docs/patterns/CreatingGameObjects.md +290 -0
- package/docs/patterns/MeshColliders.md +338 -0
- package/docs/patterns/MeshLoading.md +316 -0
- package/docs/physics/Colliders.md +249 -0
- package/docs/physics/PhysicsSystem.md +151 -0
- package/docs/physics/RigidBodyComponent.md +201 -0
- package/docs/rendering/AssetManager.md +308 -0
- package/docs/rendering/InstancedRenderer.md +286 -0
- package/docs/rendering/MeshRenderer.md +286 -0
- package/docs/rendering/SkeletalRenderer.md +308 -0
- package/docs/systems/AnimationSystem.md +75 -0
- package/docs/systems/AudioSystem.md +79 -0
- package/docs/systems/InputManager.md +101 -0
- package/docs/systems/LightingSystem.md +101 -0
- package/docs/systems/NavigationSystem.md +246 -0
- package/docs/systems/ParticleSystem.md +44 -0
- package/docs/systems/PrefabSystem.md +60 -0
- package/docs/systems/SplineSystem.md +194 -0
- package/docs/systems/StowKitSystem.md +77 -0
- package/docs/systems/TweenSystem.md +132 -0
- package/docs/systems/UISystem.md +73 -0
- package/package.json +62 -0
- package/scripts/postinstall.mjs +51 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# TweenSystem
|
|
2
|
+
|
|
3
|
+
Property animation system with easing functions for smooth transitions.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { TweenSystem, Easing } from "@series-ai/rundot-3d-engine/systems"
|
|
9
|
+
|
|
10
|
+
// Animate object property
|
|
11
|
+
TweenSystem.tween(
|
|
12
|
+
this, // Target object
|
|
13
|
+
"alpha", // Property name
|
|
14
|
+
1.0, // End value
|
|
15
|
+
0.5, // Duration (seconds)
|
|
16
|
+
Easing.easeOutQuad // Easing function
|
|
17
|
+
)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Common Use Cases
|
|
21
|
+
|
|
22
|
+
### Fade In/Out
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
class FadeEffect extends Component {
|
|
26
|
+
private alpha: number = 0
|
|
27
|
+
|
|
28
|
+
public fadeIn(): void {
|
|
29
|
+
const tween = TweenSystem.tween(this, "alpha", 1.0, 0.5, Easing.easeInOutQuad)
|
|
30
|
+
|
|
31
|
+
tween.onUpdated((value) => {
|
|
32
|
+
// Apply alpha to material
|
|
33
|
+
this.material.opacity = value
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
tween.onCompleted(() => {
|
|
37
|
+
console.log("Fade in complete!")
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Scale Pop Animation
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
class Pickup extends Component {
|
|
47
|
+
private tweenScale: number = 1.0
|
|
48
|
+
|
|
49
|
+
public quickPop(): void {
|
|
50
|
+
this.tweenScale = 1.0
|
|
51
|
+
|
|
52
|
+
// Pop up
|
|
53
|
+
const popTween = TweenSystem.tween(this, "tweenScale", 1.35, 0.12, Easing.easeOutQuad)
|
|
54
|
+
popTween.onUpdated((value) => {
|
|
55
|
+
this.gameObject.scale.set(value, value, value)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
// Then shrink
|
|
59
|
+
popTween.onCompleted(() => {
|
|
60
|
+
const shrinkTween = TweenSystem.tween(this, "tweenScale", 0, 0.3, Easing.easeInOutQuad)
|
|
61
|
+
shrinkTween.onUpdated((value) => {
|
|
62
|
+
this.gameObject.scale.set(value, value, value)
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Move Object
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
class Mover extends Component {
|
|
73
|
+
public moveTo(targetPos: THREE.Vector3, duration: number): void {
|
|
74
|
+
TweenSystem.tween(this.gameObject.position, "x", targetPos.x, duration, Easing.easeInOutQuad)
|
|
75
|
+
TweenSystem.tween(this.gameObject.position, "y", targetPos.y, duration, Easing.easeInOutQuad)
|
|
76
|
+
TweenSystem.tween(this.gameObject.position, "z", targetPos.z, duration, Easing.easeInOutQuad)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Easing Functions
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
Easing.linear // No easing
|
|
85
|
+
Easing.easeInQuad // Accelerate
|
|
86
|
+
Easing.easeOutQuad // Decelerate
|
|
87
|
+
Easing.easeInOutQuad // Smooth start and end
|
|
88
|
+
Easing.easeInCubic // Stronger acceleration
|
|
89
|
+
Easing.easeOutCubic // Stronger deceleration
|
|
90
|
+
Easing.easeInOutCubic // Smooth cubic
|
|
91
|
+
Easing.spring // Spring physics
|
|
92
|
+
Easing.easeOutElastic // Elastic bounce
|
|
93
|
+
Easing.easeOutBack // Overshoot
|
|
94
|
+
Easing.anticipateOvershoot // Go back then overshoot
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## API Overview
|
|
98
|
+
|
|
99
|
+
### TweenSystem
|
|
100
|
+
- `tween(target, property, endValue, duration, easing)` - Create tween
|
|
101
|
+
- `update(deltaTime)` - Update all tweens (automatic)
|
|
102
|
+
|
|
103
|
+
### Tween
|
|
104
|
+
- `onUpdated(callback)` - Called each frame with current value
|
|
105
|
+
- `onCompleted(callback)` - Called when tween finishes
|
|
106
|
+
- `cancel()` - Stop tween early
|
|
107
|
+
|
|
108
|
+
## Patterns
|
|
109
|
+
|
|
110
|
+
### Chain Tweens
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
const tween1 = TweenSystem.tween(this, "x", 10, 1, Easing.easeInOutQuad)
|
|
114
|
+
tween1.onCompleted(() => {
|
|
115
|
+
const tween2 = TweenSystem.tween(this, "y", 5, 1, Easing.easeInOutQuad)
|
|
116
|
+
})
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Parallel Tweens
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
// Multiple properties at once
|
|
123
|
+
TweenSystem.tween(obj.position, "x", 10, 1, Easing.linear)
|
|
124
|
+
TweenSystem.tween(obj.position, "y", 5, 1, Easing.linear)
|
|
125
|
+
TweenSystem.tween(obj.rotation, "y", Math.PI, 1, Easing.linear)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Related Systems
|
|
129
|
+
|
|
130
|
+
- [VenusGame](../core/VenusGame.md) - Updates TweenSystem automatically
|
|
131
|
+
- [Component](../core/Component.md) - Use tweens in components
|
|
132
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# UISystem
|
|
2
|
+
|
|
3
|
+
UI utilities and loading screen management.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { UISystem } from "@series-ai/rundot-3d-engine/systems"
|
|
9
|
+
|
|
10
|
+
// Show loading screen
|
|
11
|
+
UISystem.showLoadingScreen()
|
|
12
|
+
|
|
13
|
+
// Hide loading screen
|
|
14
|
+
UISystem.hideLoadingScreen()
|
|
15
|
+
|
|
16
|
+
// Create UI elements (use standard HTML/CSS)
|
|
17
|
+
const button = document.createElement("button")
|
|
18
|
+
button.textContent = "Click Me"
|
|
19
|
+
button.style.position = "absolute"
|
|
20
|
+
button.style.top = "50%"
|
|
21
|
+
button.style.left = "50%"
|
|
22
|
+
document.body.appendChild(button)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Common Use Cases
|
|
26
|
+
|
|
27
|
+
### Loading Screen
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
class MyGame extends VenusGame {
|
|
31
|
+
protected async onStart(): Promise<void> {
|
|
32
|
+
UISystem.showLoadingScreen()
|
|
33
|
+
|
|
34
|
+
// Load assets
|
|
35
|
+
await this.loadAssets()
|
|
36
|
+
|
|
37
|
+
UISystem.hideLoadingScreen()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### HUD Elements
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
class ScoreDisplay {
|
|
46
|
+
private scoreElement: HTMLDivElement
|
|
47
|
+
|
|
48
|
+
constructor() {
|
|
49
|
+
this.scoreElement = document.createElement("div")
|
|
50
|
+
this.scoreElement.style.position = "absolute"
|
|
51
|
+
this.scoreElement.style.top = "20px"
|
|
52
|
+
this.scoreElement.style.right = "20px"
|
|
53
|
+
this.scoreElement.style.color = "white"
|
|
54
|
+
this.scoreElement.style.fontSize = "24px"
|
|
55
|
+
document.body.appendChild(this.scoreElement)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
updateScore(score: number): void {
|
|
59
|
+
this.scoreElement.textContent = `Score: ${score}`
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## API Overview
|
|
65
|
+
|
|
66
|
+
- `showLoadingScreen()` - Show loading overlay
|
|
67
|
+
- `hideLoadingScreen()` - Hide loading overlay
|
|
68
|
+
- Use standard DOM APIs for custom UI
|
|
69
|
+
|
|
70
|
+
## Related Systems
|
|
71
|
+
|
|
72
|
+
- [VenusGame](../core/VenusGame.md) - Game initialization
|
|
73
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@series-inc/rundot-3d-engine",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsup",
|
|
8
|
+
"dev": "tsup --watch",
|
|
9
|
+
"publish": "npm publish",
|
|
10
|
+
"lint": "eslint src",
|
|
11
|
+
"lint:fix": "eslint src --fix",
|
|
12
|
+
"format": "prettier --write .",
|
|
13
|
+
"format:check": "prettier --check .",
|
|
14
|
+
"postinstall": "node scripts/postinstall.mjs"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/series-ai/Run.3DEngine.git",
|
|
19
|
+
"directory": "."
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"require": "./dist/index.cjs"
|
|
26
|
+
},
|
|
27
|
+
"./systems": {
|
|
28
|
+
"types": "./dist/systems/index.d.ts",
|
|
29
|
+
"import": "./dist/systems/index.js",
|
|
30
|
+
"require": "./dist/systems/index.cjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@dimforge/rapier3d": "^0.11.2",
|
|
35
|
+
"@dimforge/rapier3d-compat": "^0.11.2",
|
|
36
|
+
"@stowkit/reader": "^0.1.39",
|
|
37
|
+
"@stowkit/three-loader": "^0.1.40",
|
|
38
|
+
"three": "^0.180.0",
|
|
39
|
+
"three-stdlib": "^2.36.0",
|
|
40
|
+
"@series-inc/rundot-game-sdk": "5.3.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/three": "^0.180.0",
|
|
44
|
+
"@types/node": "^20.11.16",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
46
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
47
|
+
"eslint": "^9.39.2",
|
|
48
|
+
"eslint-import-resolver-typescript": "^4.4.1",
|
|
49
|
+
"eslint-plugin-import": "^2.31.0",
|
|
50
|
+
"prettier": "^3.2.4",
|
|
51
|
+
"tsup": "^8.5.0",
|
|
52
|
+
"typescript": "^5.3.3"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist",
|
|
59
|
+
"docs",
|
|
60
|
+
"scripts"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, rmSync, readdirSync, copyFileSync, statSync } from "fs";
|
|
2
|
+
import { dirname, join, resolve } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const packageRoot = resolve(__dirname, "..");
|
|
7
|
+
const docsSource = join(packageRoot, "docs");
|
|
8
|
+
|
|
9
|
+
if (!existsSync(docsSource)) {
|
|
10
|
+
process.exit(0);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Walk up from the package root to find the consuming project root.
|
|
14
|
+
// If we're inside node_modules, exit out of it. Otherwise (e.g. local dev), use packageRoot.
|
|
15
|
+
function findProjectRoot() {
|
|
16
|
+
let dir = packageRoot;
|
|
17
|
+
while (true) {
|
|
18
|
+
const parent = dirname(dir);
|
|
19
|
+
if (parent === dir) break; // filesystem root
|
|
20
|
+
const baseName = dir.split(/[\\/]/).pop();
|
|
21
|
+
if (baseName === "node_modules") {
|
|
22
|
+
return parent;
|
|
23
|
+
}
|
|
24
|
+
dir = parent;
|
|
25
|
+
}
|
|
26
|
+
// Not inside node_modules — running locally in the package itself
|
|
27
|
+
return packageRoot;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const projectRoot = findProjectRoot();
|
|
31
|
+
const docsDest = join(projectRoot, ".rundot", "3d-engine-docs");
|
|
32
|
+
|
|
33
|
+
// Remove existing docs to keep them in sync
|
|
34
|
+
if (existsSync(docsDest)) {
|
|
35
|
+
rmSync(docsDest, { recursive: true, force: true });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function copyDir(src, dest) {
|
|
39
|
+
mkdirSync(dest, { recursive: true });
|
|
40
|
+
for (const entry of readdirSync(src)) {
|
|
41
|
+
const srcPath = join(src, entry);
|
|
42
|
+
const destPath = join(dest, entry);
|
|
43
|
+
if (statSync(srcPath).isDirectory()) {
|
|
44
|
+
copyDir(srcPath, destPath);
|
|
45
|
+
} else {
|
|
46
|
+
copyFileSync(srcPath, destPath);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
copyDir(docsSource, docsDest);
|