Files
UoL/CM2030 Graphics Programming/Topic 8/8.3.3 Additive Synthesis Circle/sketch.js
2021-07-17 12:40:10 -05:00

27 lines
604 B
JavaScript

function setup() {
createCanvas(550,550);
background(0);
angleMode(DEGREES);
}
/////////////////////////////////////////////////
function draw() {
background(0);
noStroke();
fill(255,0,255);
translate(width/2,height/2);
//ADDITIVE SYNTHESIS IN A CIRCLE
var radius = 150;
beginShape();
for (var theta=0; theta<360; theta+=1){
var wave1 = 0;// your sine code here
var wave2 = 0;// your noise code here
var r = radius + wave1 + wave2;
var x = cos(theta) * r;
var y = sin(theta) * r;
vertex(x,y);
}
endShape(CLOSE);
}