init repository with p5js and babylon

This commit is contained in:
pobadoba
2026-05-05 18:17:28 +09:00
commit 66f5f35a9e
13 changed files with 1682 additions and 0 deletions

16
src/multi_sketch.js Normal file
View File

@@ -0,0 +1,16 @@
import * as BABYLON from "babylonjs";
const canvas = document.getElementById("renderCanvas");
const engine = new BABYLON.Engine(canvas, true);
const scene = new BABYLON.Scene(engine);
const camera = new BABYLON.ArcRotateCamera("cam", 0, 0, 10, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);
const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene);
const sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {}, scene);
engine.runRenderLoop(() => {
scene.render();
});

20
src/single_sketch.js Normal file
View File

@@ -0,0 +1,20 @@
import '../css/style.css';
import {sketch} from 'p5js-wrapper';
sketch.setup = function(){
createCanvas (800, 600);
}
sketch.draw= function(){
background(100);
fill(255, 0, 0);
noStroke();
rectMode(CENTER);
rect(mouseX, mouseY, 50, 50);
}
sketch.mousePressed = function(){
console.log('here');
}