MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / createRoot

Method createRoot

assets/js/svg-generator.js:43–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 };
42
43 createRoot() {
44 this.root = [];
45 let angle = this.angle;
46 let x = -overflow + angle;
47 let y = 0;
48 let rootY = this.rootY;
49 let upSideDown = 0;
50
51 this.root.push({ x: x, y: rootY});
52
53 while (x < winW) {
54 let value = Math.random() > 0.5 ? 1 : -1;
55
56 // Crazyness
57 if (settings.crazyness) {
58 x += parseInt((Math.random() * settings.straightness / 2) + (settings.straightness / 2));
59 y = (parseInt((Math.random() * settings.height / 2) + (settings.height / 2)) * value) + rootY;
60 } else {
61 // Geometric
62 upSideDown = !upSideDown;
63 value = (upSideDown == 0) ? 1 : -1;
64
65 x += settings.straightness;
66 y = settings.height * value + rootY;
67 }
68
69 this.root.push({ x: x, y: y});
70 };
71
72 this.root.push({ x: winW + overflow, y: rootY});
73 };
74
75 createCircles() {
76 const fill = '#fff';

Callers 1

funcFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected