Skip to content

Instantly share code, notes, and snippets.

View flordefuego's full-sized avatar

Flor de Fuego flordefuego

View GitHub Profile
//Animated gif with Ted Davis help
await loadScript("https://cdn.jsdelivr.net/npm/p5.glitch@latest/p5.glitch.js") //loads p5glitch library in Hydra
let glitch;
p = new P5() //comment this line after using it once
glitch = new Glitch(p);
img = p.loadImage('https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExYzA0ZmE1ZDNmNTU1NzJkNDg3MWFmZWViZWVkOTk1OTEzMmQ5OWQ4OSZjdD1z/3o6fJ3xFENBRxVFvUc/giphy.gif', function(im) {
});
/*
_hydra_texture // cc ojack.xyz + teddavis.org 2021
edit hydra code within // hydraSandbox tags for changes w/o recompiling p5!
cheatsheets: https://ojack.xyz/hydra-functions/ + https://hydra-book.naotohieda.com/
*/
let img;
let genie;
function preload() {
img = loadImage('https://raw.githubusercontent.com/flordefuego/test_to_upload_stuff/main/genie.png');
genie = loadModel('https://raw.githubusercontent.com/flordefuego/test_to_upload_stuff/main/genie.obj')
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()