xxxxxxxxxx
147
let data;
let x = 50;
let y = 50;
function preload() {
data = loadTable("Ex3.csv", "csv", "header");
}
function setup() {
createCanvas(1385, 830);
console.log(data);
noLoop();
}
function draw() {
describe('Grid of squares illustrating language used between parent and children, each with pink, light blue, or purple concentric circles of varying size. A vertical or horizontal line extending from the center of the circle to the side. Each square includes a green rectangle covering the top or bottom half of the square');
background(220);
square(10, 10, 80);
for(let ybox = 10; ybox <= 800; ybox+= 80){
for (let xbox = 10; xbox <=1364; xbox +=80)
squareBoxes(xbox, ybox, 80);
}
for (let r = 0; r < data.getRowCount(); r++) {
const day = data.getNum(r, "day");
const ampm = data.get(r, "ampm");
const kid = data.get(r, "kid");
const mMood = data.getNum(r, "mMood");
const kMood = data.getNum(r, "kMood");
const momlang = data.get(r, "momlang");
if (ampm === "AM"){
//print("am");
noStroke();
fill("#97DEC9");
square(x, y, -39);
square(x, y-39, 39);
} else {
//print("pm");
noStroke();
fill("#97DEC9");
square(x, y, 39);
square(x-39, y, 39);
}
if (kid === "0") {
//print("jp ari blue");
stroke("#6E8696");
fill("#B4DAF5");
} else if (kid === "1") {
//print("jp kiyo pink");
stroke("#9E79A6");
fill("#F3BAFF");
} else if (kid === "2") {
//print("jp both purple");
stroke("#76729C");
fill("#AFA8E6");
}
circle(x, y, 10);
// print("width is " + width + ". x is currently " + x + " and y is currently " + y);
if (kMood == "1"){
circle(x, y, 10);
} else if (kMood == "2") {
circle(x, y, 20);
} else if (kMood =="3") {
circle(x,y, 30);
} else if (kMood =="4") {
circle(x, y, 40);
} else if (kMood == "5") {
circle(x, y, 50);
}
if (mMood =="5") {
stroke(0);
noFill();
circle(x, y, 50);
circle(x, y, 40);
circle(x, y, 30);
circle(x, y, 20);
circle(x, y, 10);
} else if (mMood == "4") {
stroke(0);
noFill();
circle(x, y, 40);
circle(x, y, 30);
circle(x, y, 20);
circle(x, y, 10);
} else if (mMood =="3") {
stroke(0);
noFill();
circle(x, y, 30);
circle(x, y, 20);
circle(x, y, 10);
} else if (mMood =="2") {
stroke(0);
noFill();
circle(x, y, 20);
circle(x, y, 10);
} else if (mMood == "1") {
stroke(0);
noFill();
circle(x, y, 10);
}
// mom's language
if (momlang === "0") {
//print("japanese");
line(x, y, x, y-40, 40);
}
else if (momlang === "1") {
//print("english");
line(x, y, x, y+40, 40);
} else if (momlang === "2") {
//print("japanenglish");
line(x, y, x+40, y, 40);
}
if (x+80 < width){
x+=80;
} else if (x + 80 > width){
x = 50;
y += 80;
}
//print("x = " + x);
}
function squareBoxes(x, y, w) {
fill(220);
square(x, y, w);
fill(0);
}
}