init repository with p5js and babylon
This commit is contained in:
16
src/multi_sketch.js
Normal file
16
src/multi_sketch.js
Normal 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
20
src/single_sketch.js
Normal 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');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user