Select Git revision
background_anim.js
background_anim.js 7.05 KiB
// Constants
const FPS = 60;
const DOTS_NUM_VALUES = [100, 75];
const VELOCITY_MAX_VALUES = [25, 15];
const RADIUS_MIN_VALUES = [1, 0.5];
const RADIUS_MAX_VALUES = [4, 2];
const LINE_DISTANCE_MAX_VALUES = [150, 65];
const LINE_WIDTH_VALUES = [0.2, 0.08];
const DOT_PUSH_DISTANCE_VALUES = [25, 20];
const DOT_FILL_COLOUR = "#666";
const DOT_OUTLINE_COLOUR = "#444";
const LINE_COLOUR = "#777";
// ----
// Sort-of constants (change with window size)
let DOTS_NUM = 100;
let VELOCITY_MAX = 25;
let RADIUS_MIN = 1;
let RADIUS_MAX = 4;
let LINE_DISTANCE_MAX = 150;
let LINE_WIDTH = 0.2;
let DOT_PUSH_DISTANCE = 25;
class Dot {
constructor(x, y, radius, vx, vy) {
this._x = x;
this._y = y;
this._radius = radius;
this._vx = vx;
this._vy = vy;
}
get x() {
return this._x;
}
set x(value) {
this._x = value;
}
get y() {
return this._y;
}
set y(value) {
this._y = value;
}
get radius() {
return this._radius;
}
set radius(value) {
this._radius = value;
}
get vx() {
return this._vx;
}
set vx(value) {
this._vx = value;
}
get vy() {
return this._vy;
}
set vy(value) {
this._vy = value;
}
}