xxxxxxxxxx
143
//this is a taxi time record of my week
//blue: Monday
//pink: Wednesday
//purple: Saturday
//yellow: Sunday
let mydata;
let taxi1;
let taxi2;
let taxi3;
let taxi4;
let backgroundmap;
let word1, word2, word3, word4, word5, word6, word7, word8, word9;
let sentence1 = ['From: Tsinghua University', 'Destination: Printing Shop', 'Get the invoices printed'];
let sentence2 = ['From: Tsinghua University', 'Destination: 76 Guitar club', 'Guitar Courses'];
let sentence3 = ['From: 76 Guitar club', 'Destination: Tsinghua University'];
let sentence4 = ['From: Tsinghua University', 'Destination: Hot Pot restaurant', 'Birthday Celebration of my classmate'];
let sentence5 = ['From: Hot Pot restaurant', 'Destination: Tsinghua University'];
let sentence6 = ['From: Tsinghua University', 'Destination: Nearby Cinema', 'Film: BALLOON'];
let sentence7 = ['From: 798 ArtDist', 'Destination: Tsinghua University', 'Exhibition'];
let sentence8 = ['From: Tsinghua University', 'Destination: Beijing Tianqiao Performing Arts Center', 'TAO Dance Theater'];
let sentence9 = ['Destination: Tsinghua University','From: Beijing Tianqiao Performing Arts Center'];
function preload(){
mydata = loadJSON("data.json");
taxi1 = loadImage("car1.png");
taxi2 = loadImage("car2.png");
taxi3 = loadImage("car3.png");
taxi4 = loadImage("car4.png");
backgroundmap = loadImage("map.jpg")
}
function setup() {
createCanvas(670, 340);
setInterval(one, 800);
setInterval(two, 900);
setInterval(three, 500);
setInterval(four, 1500);
setInterval(five, 600);
setInterval(six, 500);
setInterval(seven, 1000);
setInterval(eight, 1300);
setInterval(nine, 1000);
}
function draw() {
image(backgroundmap,0,0)
for (let i = 0; i < mydata.Monday.taxi.length; i++){
stroke(173,216,230);
strokeWeight(3);
noFill();
ellipse(mydata.Monday.taxi[i] * 40-300, 60,67.5);
}
for (let j = 0; j < mydata.Wednesday.taxi.length;
j++){
stroke(205,182,193);
strokeWeight(3);
noFill();
ellipse(mydata.Wednesday.taxi[j] * 40-300, 120,61.52);
}
for (let o = 0; o < mydata.Saturday.taxi.length;
o++){
stroke(147,112,219);
strokeWeight(3);
noFill();
ellipse(mydata.Saturday.taxi[o] * 40-300, 180,46.34);
}
for (let e = 0; e < mydata.Sunday.taxi.length;
e++){
stroke(255,239,213);
strokeWeight(3);
noFill();
ellipse(mydata.Sunday.taxi[e] * 40-300, 240,143.3);
}
textSize(13);
noStroke();
fill(255);
text(word1, 60, 60);
text(word2,220,40)
text(word3, 340, 75);
textSize(11);
noStroke();
text(word4,170, 130);
text(word5,300, 140);
text(word6,490, 130);
textSize(8);
noStroke();
text(word7,510, 190);
textSize(16);
noStroke();
text(word8,240, 230);
text(word9,330, 270);
}
function one(){
word1 = random(sentence1);
}
function two(){
word2 = random(sentence2);
}
function three(){
word3 = random(sentence3);
}
function four(){
word4 = random(sentence4);
}
function five(){
word5 = random(sentence5);
}
function six(){
word6 = random(sentence6);
}
function seven(){
word7 = random(sentence7);
}
function eight(){
word8 = random(sentence8);
}
function nine(){
word9 = random(sentence9);
}