You can install easy-three using npm or yarn.
This method is not recommended for beginners.
npm install @masabando/easy-three
import { init } from "@masabando/easy-three";
You can use the template to create a new project.
The template includes the necessary settings for easy-three.
※ Be sure to extract the zip file before use.
You can display it by dragging and dropping the index.html file into a web browser.
To edit the code, use an editor like VSCode.
For more information on how to use the template, see the Reference .
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/",
"@pixiv/three-vrm": "https://cdn.jsdelivr.net/npm/@pixiv/three-vrm@3/lib/three-vrm.module.min.js",
"easy-three": "https://cdn.jsdelivr.net/gh/masabando/easy-three@1.1.4/dist/easy-three.js"
}
}
</script>
import { init } from "easy-three";
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>easy-three template</title>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/",
"@pixiv/three-vrm": "https://cdn.jsdelivr.net/npm/@pixiv/three-vrm@3/lib/three-vrm.module.min.js",
"easy-three": "https://cdn.jsdelivr.net/gh/masabando/easy-three@1.1.4/dist/easy-three.js"
}
}
</script>
</head>
<body>
<script type="module">
import { init } from "easy-three";
const { camera, create, animate, controls } = init();
controls.connect()
camera.position.set(-2, 2, 2)
create.ambientLight()
create.directionalLight()
create.cube()
animate()
</script>
</body>
</html>
npx serve
python3 -m http.server