//Shannon Case
//Section D
//scase@andrew.cmu.edu
//project 05
//sets global variables
var RingSize = 50;
var spacing = 125;
var innerRing = RingSize-10;
var x = 50;
var y = 50;
var bitX = 0;
var bitY = 0;
function setup() {
createCanvas(600,600);
background(0);
}
function draw() {
for(var bitX=0; bitX < width; bitX+=90) { //sets x location of bits
for(var bitY= 0; bitY < height; bitY+=30){ //sets y location of bits
bit(bitX, bitY); //draw bits
}
}
}
function bit(x,y) {
push();
translate(x,y);
fill(150); //creates left and right rings
ellipse(x,y,RingSize,RingSize);
ellipse(x+spacing,y,RingSize,RingSize);
fill(0); //fills the inner part of the rings
ellipse(x,y,innerRing,innerRing);
ellipse(x+spacing,y,innerRing,innerRing);
fill(150); //creates the mouth piece
rect(x+10,y-5,105,10,20);
ellipse(x+60,y,20,20);
pop();
}
For this project I was inspired by a horse bit, which is a piece of equipment used in a horse’s mouth to aid in steering when they are ridden. So I chose to make a loop that creates a pattern out of these bits. Below is a reference photo: