Created
April 23, 2019 07:38
-
-
Save innocuo/e9fb9b78b6e2227ee64317cca19c76e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//p5 js example | |
function setup() { | |
createCanvas(200, 100); | |
frameRate(24); | |
} | |
let angle = 0; | |
let sin1 = 0; | |
let sin2 = 0; | |
let angle_inc = .2; | |
let segment_width = 5; | |
function draw() { | |
background(230); | |
for(let j=0;j<13;j++){ | |
for(let i=0;i<39;i++){ | |
let prevsin1 = sin1; | |
sin1 = Math.round(Math.sin(angle+(angle_inc*i))*10); | |
sin2 = Math.round(Math.sin(angle+(angle_inc*(i+1)))*10); | |
let x1= 2+segment_width*i; | |
let y1=(20+j*4)+sin1; | |
let x2 = x1+segment_width; | |
let y2 = (20+j*4)+sin2; | |
stroke(Math.round(j*66.4),i*j,Math.round(i*1.4)); | |
line(x1,y1,x2,y2); | |
} | |
} | |
angle+=angle_inc; | |
angle%=360; | |
angle_inc =Math.random(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment