Skip to content

Instantly share code, notes, and snippets.

View flordefuego's full-sized avatar

Flor de Fuego flordefuego

View GitHub Profile
p = new P5()
p.draw= ()=>{
p.noStroke();
p.rect(p.width/2,p.height/2,100)
}
p.hide();
s0.init({src:p.canvas})
p = new P5({mode: 'WEBGL'})
p.draw= ()=>{
p.background(0,0,0,0);
p.orbitControl(5);
p.fill(255);
p.torus(150,15,5);
}
p.hide();
@flordefuego
flordefuego / hydraP5jsGyroscope.js
Created February 17, 2023 20:30
Gyroscope example for Hydra with p5js
//p5 sketch from https://editor.p5js.org/remarkability/sketches/1D90zhu4a
p = new P5()
let permissionGranted = false;
let cx, cy;
cx = p.width/2;
cy = p.height/2;
// DeviceOrientationEvent, DeviceMotionEvent
if (typeof(DeviceOrientationEvent) !== 'undefined' && typeof(DeviceOrientationEvent.requestPermission) === 'function') {
// ios 13 device
DeviceOrientationEvent.requestPermission()