Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workspaces with vite for demo running, and rollup for module building #147

Merged
merged 12 commits into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,13 @@ Completed all iterations!

30000013 nodes executed in 2.98 seconds, at a rate of 10067118 steps/second
```

## Developer Setup

Install all dependencies:

yarn install

To start the examples:

yarn dev
14 changes: 14 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
bugfixes: true,
targets: {
esmodules: true,
},
},
],
'@babel/preset-typescript',
],
};
28 changes: 28 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Behave-Graph - Standalone Three.js Example</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<style>
html,
body {
height: 100%;
margin: 0;
overflow: hidden; /* avoid feedback loop where canvas grows out of control. */
}
.framebuffer {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<script type="module" src="src/three/index.ts"></script>
Look in the console for output!<br />
Three.JS Example.<br /><br />
</body>
</html>
28 changes: 28 additions & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@behave-graph/examples",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"directories": {
"lib": "lib"
},
"dependencies": {
"three": "^0.145.0",
"threeify": "^2.0.2",
"behave-graph": "*"
},
"devDependencies": {
"vite": "^3.2.3",
"commander": "^9.4.1",
"ts-node": "^10.9.1",
"typescript": "^4.7.3"
},
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"author": "",
"license": "ISC"
}
Binary file not shown.
122 changes: 122 additions & 0 deletions examples/public/graphs/scene/actions/FlashSuzanne.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"customEvents": [
{
"name": "hideSuzanne",
"id": "0"
},
{
"name": "showSuzanne",
"id": "1"
}
],
"nodes": [
{
"type": "lifecycle/onStart",
"id": "0",
"flows": {
"flow": {
"nodeId": "1",
"socket": "flow"
}
}
},
{
"type": "customEvent/trigger/0",
"id": "1"
},
{
"type": "customEvent/onTriggered/0",
"id": "2",
"flows": {
"flow": {
"nodeId": "3",
"socket": "flow"
}
}
},
{
"type": "scene/set/boolean",
"id": "3",
"parameters": {
"jsonPath": {
"value": "/nodes/0/visible"
},
"value": {
"value": false
}
},
"flows": {
"flow": {
"nodeId": "4",
"socket": "flow"
}
}
},
{
"type": "flow/delay",
"id": "4",
"parameters": {
"duration": {
"value": 1
}
},
"flows": {
"flow": {
"nodeId": "5",
"socket": "flow"
}
}
},
{
"type": "customEvent/trigger/1",
"id": "5"
},
{
"type": "customEvent/onTriggered/1",
"id": "6",
"flows": {
"flow": {
"nodeId": "7",
"socket": "flow"
}
}
},
{
"type": "scene/set/boolean",
"id": "7",
"parameters": {
"jsonPath": {
"value": "/nodes/0/visible"
},
"value": {
"value": true
}
},
"flows": {
"flow": {
"nodeId": "8",
"socket": "flow"
}
}
},
{
"type": "flow/delay",
"id": "8",
"parameters": {
"duration": {
"value": 1
}
},
"flows": {
"flow": {
"nodeId": "9",
"socket": "flow"
}
}
},
{
"type": "customEvent/trigger/0",
"id": "9"
}
]
}
122 changes: 122 additions & 0 deletions examples/public/graphs/scene/actions/Hierarchy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"customEvents": [
{
"name": "hideHierarchy",
"id": "0"
},
{
"name": "showHierarchy",
"id": "1"
}
],
"nodes": [
{
"type": "lifecycle/onStart",
"id": "0",
"flows": {
"flow": {
"nodeId": "1",
"socket": "flow"
}
}
},
{
"type": "customEvent/trigger/0",
"id": "1"
},
{
"type": "customEvent/onTriggered/0",
"id": "2",
"flows": {
"flow": {
"nodeId": "3",
"socket": "flow"
}
}
},
{
"type": "scene/set/boolean",
"id": "3",
"parameters": {
"jsonPath": {
"value": "/nodes/3/visible"
},
"value": {
"value": false
}
},
"flows": {
"flow": {
"nodeId": "4",
"socket": "flow"
}
}
},
{
"type": "flow/delay",
"id": "4",
"parameters": {
"duration": {
"value": 1
}
},
"flows": {
"flow": {
"nodeId": "5",
"socket": "flow"
}
}
},
{
"type": "customEvent/trigger/1",
"id": "5"
},
{
"type": "customEvent/onTriggered/1",
"id": "6",
"flows": {
"flow": {
"nodeId": "7",
"socket": "flow"
}
}
},
{
"type": "scene/set/boolean",
"id": "7",
"parameters": {
"jsonPath": {
"value": "/nodes/3/visible"
},
"value": {
"value": true
}
},
"flows": {
"flow": {
"nodeId": "8",
"socket": "flow"
}
}
},
{
"type": "flow/delay",
"id": "8",
"parameters": {
"duration": {
"value": 1
}
},
"flows": {
"flow": {
"nodeId": "9",
"socket": "flow"
}
}
},
{
"type": "customEvent/trigger/0",
"id": "9"
}
]
}
59 changes: 59 additions & 0 deletions examples/public/graphs/scene/actions/SpinningSuzanne.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"nodes": [
{
"type": "lifecycle/onTick",
"id": "0",
"flows": {
"flow": {
"nodeId": "3",
"socket": "flow"
}
}
},
{
"type": "math/create/euler",
"id": "1",
"parameters": {
"x": {
"link": {
"nodeId": 0,
"socket": "time"
}
},
"y": {
"value": 0
},
"z": {
"value": 0
}
}
},
{
"type": "math/toQuat/euler",
"id": "2",
"parameters": {
"a": {
"link": {
"nodeId": 1,
"socket": "result"
}
}
}
},
{
"type": "scene/set/quat",
"id": "3",
"parameters": {
"jsonPath": {
"value": "/nodes/0/rotation"
},
"value": {
"link": {
"nodeId": 2,
"socket": "result"
}
}
}
}
]
}
Loading