Skip to content

Instantly share code, notes, and snippets.

View andrusenn's full-sized avatar

Andru andrusenn

View GitHub Profile
@andrusenn
andrusenn / Plexus.js
Last active December 1, 2022 16:03
Plexus network
/**
Plexus structure for p5js
Ponints connected
*/
function Plexus(_op) {
let opts = {
num: 40,
cx: 0,
cy: 0,
@andrusenn
andrusenn / pendulums.js
Created November 22, 2022 21:05
Armonografo y pendulos
/**
Maneja los péndulos
*/
class Harmonograph {
constructor(p) {
this.pendulums = p;
}
update(fn, laps = 10) {
for (let j = 0; j < laps; j++) {
let px = 0;
@andrusenn
andrusenn / ACore.js
Last active November 14, 2022 16:26
Dibujar en canvas. Inspirado en p5js
/*
Codigo reducido
inspirado en p5js
v 20221114
*/
"use strict";
let _stroke = true,
_fill = true,
__shadow = false,
__cx,
@andrusenn
andrusenn / simplexNoise3D.js
Created October 28, 2022 21:17
simplex noise by Jonas Wagner / Only 3d part
// simplex noise by Jonas Wagner
// Only 3d
const F3 = 1.0 / 3.0;
const G3 = 1.0 / 6.0;
const fastFloor = (x) => Math.floor(x) | 0;
const grad3 = new Float64Array([
1, 1, 0, -1, 1, 0, 1, -1, 0, -1, -1, 0, 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0,
-1, 0, 1, 1, 0, -1, 1, 0, 1, -1, 0, -1, -1,
]);
@andrusenn
andrusenn / Random.js
Last active November 11, 2022 14:54
Random function
// Random function w/ seed
/*
// seeding -> cyrb128 + mulberry32
let random = _createRandom(seed?);
// Use
random() -> 0 to < 1
random(5,15) -> 5 to < 15
*/
function _createRandom(seed = "") {
let cyrb128 = (str) => {
@andrusenn
andrusenn / Harmonograph.js
Created March 7, 2022 14:44
Harmonograph
class Harmonograph {
constructor() {
this.theta = 0.0;
this.phi = 0.0;
this.vel_theta = 0;
this.vel_phi = 0;
this.alpha = 0.0;
this.radio_x1;
this.vel_alpha = 0;
this.friction = 0;
did:3:bafyreihn7ntavn5tjnnd75e4krdwbr5mjwmxbhimtmd3vatm2zt5owpr5a
/*
Controles / Controls
z: Alternar retorno prticulas / Toggle particles return
x: Mantener presionado para que no borre / Keep pressed for not fade to black
s: captura imagen / image capture
Andrés Senn
andressenn.com
@andrusenn
andrusenn / alebrije.js
Created November 8, 2019 13:00
Code for LeParc
// Hola LeParc!
colorMode(HSB, 255)
function draw() {
fade(random(255),255,255,10)
zoom(0.1)
displace(-5,0)
fill(45, 255, 255, 100)
noStroke()
@andrusenn
andrusenn / LiveRect.js
Created July 20, 2019 19:10
Visuals: Minimal 2 Rects
/*
Leparc > 0.2.0
Andres Senn
*/
colorMode(HSB, 255)
function draw() {
// bg(0)
zoom(0.01)