-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add utils file. Add html webpack file to autogenerate html.
- Loading branch information
1 parent
beaaec0
commit 9821370
Showing
9 changed files
with
375 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Canvas Template</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
</style> | ||
<meta charset="UTF-8"> | ||
<title>Canvas Template</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<canvas></canvas> | ||
<script src="js/canvas.bundle.js"></script> | ||
</body> | ||
<canvas></canvas> | ||
<script type="text/javascript" src="./js/canvas.bundle.js"></script></body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Canvas Template</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<canvas></canvas> | ||
</body> | ||
</html> |
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,16 @@ | ||
function randomIntFromRange(min, max) { | ||
return Math.floor(Math.random() * (max - min + 1) + min) | ||
} | ||
|
||
function randomColor(colors) { | ||
return colors[Math.floor(Math.random() * colors.length)] | ||
} | ||
|
||
function distance(x1, y1, x2, y2) { | ||
const xDist = x2 - x1 | ||
const yDist = y2 - y1 | ||
|
||
return Math.sqrt(Math.pow(xDist, 2) + Math.pow(yDist, 2)) | ||
} | ||
|
||
module.exports = { randomIntFromRange, randomColor, distance } |
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
Oops, something went wrong.