-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d09f22
commit c57df8f
Showing
8 changed files
with
501 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
let showFPS = false; | ||
let fpsLimit = 60; | ||
|
||
let transparentBackground = false; | ||
let backgroundColor1 = "#7b00ff"; | ||
let backgroundColor2 = "#1a237e"; | ||
|
||
let particleColor = "#ffffff"; | ||
let lineColor = "#ffffff"; | ||
|
||
let particleQuantity = 100; | ||
|
||
let particleRadius = 3; | ||
let lineWidth = 2; | ||
|
||
let minVelocity = 0.5; | ||
let maxVelocity = 2; | ||
|
||
let disapearOffset = 150; // Distance At Which The Particles Disapear (Leave It Equal To The maxDistOpacity For Smooth Transition) | ||
let minDistOpacity = 50; // Distance Between Particles At Which The Line Starts To Fade | ||
let maxDistOpacity = 150; // Distance Between Particles At Which The Line Is No Longer Visible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,70 @@ | ||
//Class Vector2D | ||
class Vector2D { | ||
constructor(x, y) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
constructor(x, y) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
|
||
//Adds A Vector To The Instance Vector | ||
add(vector) { | ||
let x = this.x + vector.x; | ||
let y = this.y + vector.y; | ||
return new Vector2D(x, y); | ||
} | ||
//Adds A Vector To The Instance Vector | ||
add(vector) { | ||
let x = this.x + vector.x; | ||
let y = this.y + vector.y; | ||
return new Vector2D(x, y); | ||
} | ||
|
||
//Subtracts A Vector To The Instance Vector | ||
sub(vector) { | ||
let x = this.x - vector.x; | ||
let y = this.y - vector.y; | ||
return new Vector2D(x, y); | ||
} | ||
//Subtracts A Vector To The Instance Vector | ||
sub(vector) { | ||
let x = this.x - vector.x; | ||
let y = this.y - vector.y; | ||
return new Vector2D(x, y); | ||
} | ||
|
||
//Multiplies The Vector By A Scalar Or Another Vector | ||
mul(arg) { | ||
if (arg instanceof Vector2D) { | ||
let x = this.x * arg.x; | ||
let y = this.y * arg.y; | ||
return new Vector2D(x, y); | ||
} | ||
else { | ||
let x = this.x * arg | ||
let y = this.y * arg | ||
return new Vector2D(x, y); | ||
} | ||
} | ||
//Multiplies The Vector By A Scalar Or Another Vector | ||
mul(arg) { | ||
if (arg instanceof Vector2D) { | ||
let x = this.x * arg.x; | ||
let y = this.y * arg.y; | ||
return new Vector2D(x, y); | ||
} else { | ||
let x = this.x * arg; | ||
let y = this.y * arg; | ||
return new Vector2D(x, y); | ||
} | ||
} | ||
|
||
//Divides The Vector By A Scalar | ||
div(num) { | ||
let x = this.x/num; | ||
let y = this.y/num; | ||
return new Vector2D(x, y); | ||
} | ||
//Divides The Vector By A Scalar | ||
div(num) { | ||
let x = this.x / num; | ||
let y = this.y / num; | ||
return new Vector2D(x, y); | ||
} | ||
|
||
//Returns The Module Of The Vector | ||
abs() { | ||
return Math.sqrt(this.x**2 + this.y**2); | ||
} | ||
//Returns The Module Of The Vector | ||
abs() { | ||
return Math.sqrt(this.x ** 2 + this.y ** 2); | ||
} | ||
|
||
//Calculates The Distance Of Two Points | ||
dist(vector) { | ||
let vec = this.sub(vector); | ||
return vec.abs(); | ||
} | ||
//Calculates The Distance Of Two Points | ||
dist(vector) { | ||
let vec = this.sub(vector); | ||
return vec.abs(); | ||
} | ||
|
||
//Calculates The Distance Of Two Points Squared (More Efficient) Thanks Two Quid ^^ | ||
squaredDist(vector) { | ||
let vec = this.sub(vector); | ||
return vec.x**2 + vec.y**2; | ||
} | ||
//Calculates The Distance Of Two Points Squared (More Efficient) Thanks Two Quid ^^ | ||
squaredDist(vector) { | ||
let vec = this.sub(vector); | ||
return vec.x ** 2 + vec.y ** 2; | ||
} | ||
|
||
//Returns A Vector That Has The Same Direction As The Instance But Has Module 1 | ||
norm() { | ||
return new Vector2D(this.x/this.abs(), this.y/this.abs()); | ||
} | ||
//Returns A Vector That Has The Same Direction As The Instance But Has Module 1 | ||
norm() { | ||
return new Vector2D(this.x / this.abs(), this.y / this.abs()); | ||
} | ||
|
||
//Returns The Max Value Of A Vector, Max Value Specified By The Parameter | ||
max(num) { | ||
let x = num * this.x/this.abs(); | ||
let y = num * this.y/this.abs(); | ||
return new Vector2D(x, y); | ||
} | ||
} | ||
//Returns The Max Value Of A Vector, Max Value Specified By The Parameter | ||
max(num) { | ||
let x = (num * this.x) / this.abs(); | ||
let y = (num * this.y) / this.abs(); | ||
return new Vector2D(x, y); | ||
} | ||
} |
Oops, something went wrong.