MATH
This commit is contained in:
parent
f910628e27
commit
31ce597c09
3 changed files with 24 additions and 5 deletions
12
entities.js
12
entities.js
|
@ -1,3 +1,11 @@
|
||||||
|
//you can change these to sexier stuff
|
||||||
|
var colors = [
|
||||||
|
"black",
|
||||||
|
"orange",
|
||||||
|
"red",
|
||||||
|
"blue",
|
||||||
|
];
|
||||||
|
|
||||||
var Clock = function(sides) {
|
var Clock = function(sides) {
|
||||||
this.sides = sides;
|
this.sides = sides;
|
||||||
this.blocks = [];
|
this.blocks = [];
|
||||||
|
@ -5,7 +13,3 @@ var Clock = function(sides) {
|
||||||
this.blocks.push([]);
|
this.blocks.push([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var Block = function(color) {
|
|
||||||
this.color = color;
|
|
||||||
};
|
|
|
@ -4,6 +4,11 @@
|
||||||
<title>Wasted Time</title>
|
<title>Wasted Time</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<center>
|
||||||
<canvas id="canvas"></canvas>
|
<canvas id="canvas"></canvas>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<script src="entities.js"></script>
|
||||||
|
<script src="main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
10
math.js
Normal file
10
math.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
function rotatePoint(x, y, theta) {
|
||||||
|
var thetaRad = theta * 0.0174532925;
|
||||||
|
var rotX = Math.cos(thetaRad) * x - Math.sin(thetaRad) * y;
|
||||||
|
var rotY = Math.sin(thetaRad) * x + Math.cos(thetaRad) * y;
|
||||||
|
|
||||||
|
return {
|
||||||
|
x: rotX,
|
||||||
|
y: rotY,
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue