xxxxxxxxxx
71
var font;
var vehicles = [];
var points;
var Ax = 100;
var Ay = 300;
function preload() {
font = loadFont("AvenirNextLTPro-Demi.otf")
}
function setup() {
createCanvas(800, 500);
points = font.textToPoints("p5js", Ax, Ay, 300);
for (var i = 0; i < points.length; i++) {
pt = points[i]
var vehicle = new Vehicle(pt.x, pt.y, i)
vehicles.push(vehicle)
}
}
function draw() {
background(22, 23, 26);
var Bx = mouseX;
var By = mouseY;
fill(35, 73, 117, 80);
stroke(250, 253, 255, 100);
strokeWeight(15)
ellipse(mouseX, mouseY, 200)
for (var i = 0; i < points.length; i++) {
vehicle = vehicles[i]
var dis = int(dist(vehicle.pos.x, vehicle.pos.y, Bx, By));
vehicle.update(dis);
vehicle.show();
// vehicle.r = random(0, 20)
}
}
//trash
// colors = {
// black: color(22, 23, 26),
// white: color(250, 253, 255, 200),
// red1: color(127, 6, 34, 200),
// red2: color(214, 36, 17, 200),
// orange: color(255, 132, 38, 200),
// yellow: color(255, 209, 0, 200),
// pink1: color(255, 128, 164, 200),
// pink2: color(255, 38, 116, 200),
// pink3: color(148, 33, 106, 200),
// purple: color(67, 0, 103, 200),
// azure: color(35, 73, 117, 200),
// blue1: color(104, 174, 212, 200),
// blue2: color(0, 120, 153, 200),
// blue3: color(0, 40, 89, 100),
// green1: color(191, 255, 60, 200),
// green2: color(16, 210, 117, 200)
// };