xxxxxxxxxx
71
// Elena Peng
// Code 1 Assignment_6_Data_Visualization
// I recorded how often I used my phone and how much time I spent on my phone for 7 days. The yellow dots in the background represent how many times I unlocked my phone in 7 days. There are 807 dots, which means I unlocked my phone every 12 mins on average.
// Each square represent how much time I spent on top 5 apps that I used the most.The larger the area is, the more time I spent on that app. Green is Wechat;red is Red;NetEaseMusic is white; Instagram is pink; Weibo is yellow.
// In total, my screen time takes up 25% of my life.
let wechat=[204,108,137,169,280,72,160];
let Red=[154,78,160,139,18,123,56];
let NetEaseMusic=[1,58,28,50,2,18,26];
let Instagram=[16,16,16,44,10,11,27];
let Weibo=[0,4,25,46,17,0,8];
function setup() {
createCanvas(600, 600);
rectMode(CENTER);
frameRate(2);
}
function draw() {
background(0);
unlock();
wechatTime();
RedTime();
NEMTime();
InsTime();
WeiboTime();
unlock();
}
function unlock(){
for(locktimes=0; locktimes<10080; locktimes+=12.49){
fill(253, 255, 115);
noStroke();
circle(random(600),random(600),1.5)
}
}
function wechatTime(){
for(a=0;a<wechat.length;a++){
fill(123, 179, 46);
noStroke();
square(random(600),random(600),wechat[a])
}
}
function RedTime(){
for(b=0;b<Red.length;b++){
fill(255,0,0);
noStroke();
square(random(600),random(600),Red[b])
}
}
function NEMTime(){
for(c=0;c<NetEaseMusic.length;c++){
fill(255);
noStroke();
square(random(600),random(600),NetEaseMusic[c])
}
}
function InsTime(){
for(d=0;d<Instagram.length;d++){
fill(225,48,108);
noStroke();
square(random(600),random(600),Instagram[d])
}
}
function WeiboTime(){
for(e=0;e<Weibo.length;e++){
fill(255, 221, 0);
noStroke();
square(random(600),random(600),Weibo[e])
}
}