From 2601ebfc33f66f27699b08fc1fa19c974e98f0af Mon Sep 17 00:00:00 2001 From: win371723sb Date: Sun, 4 Feb 2024 18:58:00 +0800 Subject: [PATCH] Sun Feb 4 18:58:00 CST 2024 inscode --- .gitignore | 31 ++++++++----------------------- .inscode | 6 +++++- index.js | 29 ++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index dc99ae8..e177731 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,10 @@ -.DS_Store -node_modules -/dist +run = "npm i && npm run dev" +language = "node" +[env] +PATH = "/root/${PROJECT_DIR}/.config/npm/node_global/bin:/root/${PROJECT_DIR}/node_modules/.bin:${PATH}" +XDG_CONFIG_HOME = "/root/.config" +npm_config_prefix = "/root/${PROJECT_DIR}/.config/npm/node_global" -# local env files -.env.local -.env.*.local - -# Log files -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -package-lock.json - -# Editor directories and files -.idea -.vscode/* -!.vscode/preview.yml -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? +[debugger] +program = "main.js" diff --git a/.inscode b/.inscode index ecc8bdd..e177731 100644 --- a/.inscode +++ b/.inscode @@ -1,6 +1,10 @@ run = "npm i && npm run dev" +language = "node" [env] PATH = "/root/${PROJECT_DIR}/.config/npm/node_global/bin:/root/${PROJECT_DIR}/node_modules/.bin:${PATH}" XDG_CONFIG_HOME = "/root/.config" -npm_config_prefix = "/root/${PROJECT_DIR}/.config/npm/node_global" \ No newline at end of file +npm_config_prefix = "/root/${PROJECT_DIR}/.config/npm/node_global" + +[debugger] +program = "main.js" diff --git a/index.js b/index.js index 2d7e683..8251506 100644 --- a/index.js +++ b/index.js @@ -1 +1,28 @@ -console.log("欢迎来到 InsCode"); \ No newline at end of file +const THREE = require('three'); + +// 创建场景 +const scene = new THREE.Scene(); + +// 创建相机 +const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); +camera.position.z = 5; + +// 创建渲染器 +const renderer = new THREE.WebGLRenderer(); +renderer.setSize(window.innerWidth, window.innerHeight); +document.body.appendChild(renderer.domElement); + +// 创建一个立方体 +const geometry = new THREE.BoxGeometry(); +const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 }); +const cube = new THREE.Mesh(geometry, material); +scene.add(cube); + +// 渲染循环 +function animate() { + requestAnimationFrame(animate); + cube.rotation.x += 0.01; + cube.rotation.y += 0.01; + renderer.render(scene, camera); +} +animate(); \ No newline at end of file -- GitLab