Skip to content

Commit f768fa1

Browse files
committed
Replace tabs to spaces
1 parent cfe4bbc commit f768fa1

File tree

1 file changed

+56
-56
lines changed

1 file changed

+56
-56
lines changed

src/scripts/leafer.js

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,72 @@ import Engine from "./engine";
22
import { Leafer, Rect } from "leafer-ui";
33

44
class LeaferEngine extends Engine {
5-
constructor() {
6-
super();
7-
this.canvas = document.createElement("canvas");
8-
this.canvas.width = this.width;
9-
this.canvas.height = this.height;
10-
this.content.appendChild(this.canvas);
11-
}
5+
constructor() {
6+
super();
7+
this.canvas = document.createElement("canvas");
8+
this.canvas.width = this.width;
9+
this.canvas.height = this.height;
10+
this.content.appendChild(this.canvas);
11+
}
1212

13-
init() {
14-
this.leaferCanvas = new Leafer({
15-
view: this.canvas,
16-
width: this.width,
17-
height: this.height,
18-
})
19-
this.leaferCanvas.pixelRatio = window.devicePixelRatio;
20-
window.canvas = this.leaferCanvas;
21-
}
13+
init() {
14+
this.leaferCanvas = new Leafer({
15+
view: this.canvas,
16+
width: this.width,
17+
height: this.height,
18+
})
19+
this.leaferCanvas.pixelRatio = window.devicePixelRatio;
20+
window.canvas = this.leaferCanvas;
21+
}
2222

23-
animate() {
23+
animate() {
2424

25-
for (let i = 0; i < this.count.value; i++) {
26-
const rect = this.rects[i];
27-
rect.x -= rect.speed;
28-
rect.el.x = rect.x;
29-
if (rect.x + rect.width < 0) {
30-
rect.x = this.width + rect.width;
31-
}
32-
}
25+
for (let i = 0; i < this.count.value; i++) {
26+
const rect = this.rects[i];
27+
rect.x -= rect.speed;
28+
rect.el.x = rect.x;
29+
if (rect.x + rect.width < 0) {
30+
rect.x = this.width + rect.width;
31+
}
32+
}
3333

34-
this.meter.tick();
34+
this.meter.tick();
3535

36-
this.request = requestAnimationFrame(() => this.animate());
37-
}
36+
this.request = requestAnimationFrame(() => this.animate());
37+
}
3838

39-
render() {
40-
// clear the canvas
41-
this.leaferCanvas.removeAll(true);
42-
this.cancelAnimationFrame(this.request);
39+
render() {
40+
// clear the canvas
41+
this.leaferCanvas.removeAll(true);
42+
this.cancelAnimationFrame(this.request);
4343

44-
// rectangle creation
45-
const rects = new Array(this.count);
46-
for (let i = 0; i < this.count.value; i++) {
47-
const x = Math.random() * this.width;
48-
const y = Math.random() * this.height;
49-
const size = 10 + Math.random() * 40;
50-
const speed = 1 + Math.random();
44+
// rectangle creation
45+
const rects = new Array(this.count);
46+
for (let i = 0; i < this.count.value; i++) {
47+
const x = Math.random() * this.width;
48+
const y = Math.random() * this.height;
49+
const size = 10 + Math.random() * 40;
50+
const speed = 1 + Math.random();
5151

52-
const fRect = new Rect({
53-
width: size,
54-
height: size,
55-
fill: "white",
56-
stroke: "black",
57-
y,
58-
x,
59-
});
60-
rects[i] = { x, y, width: size, height: size / 2, speed, el: fRect };
61-
}
62-
this.rects = rects;
63-
this.leaferCanvas.addMany(...rects.map((rect) => rect.el));
52+
const fRect = new Rect({
53+
width: size,
54+
height: size,
55+
fill: "white",
56+
stroke: "black",
57+
y,
58+
x,
59+
});
60+
rects[i] = { x, y, width: size, height: size / 2, speed, el: fRect };
61+
}
62+
this.rects = rects;
63+
this.leaferCanvas.addMany(...rects.map((rect) => rect.el));
6464

65-
this.request = requestAnimationFrame(() => this.animate());
66-
}
65+
this.request = requestAnimationFrame(() => this.animate());
66+
}
6767
}
6868

6969
document.addEventListener("DOMContentLoaded", () => {
70-
const engine = new LeaferEngine();
71-
engine.init();
72-
engine.render();
70+
const engine = new LeaferEngine();
71+
engine.init();
72+
engine.render();
7373
});

0 commit comments

Comments
 (0)