This file contains hidden or 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
// Result: http://puu.sh/j19yl/d37b20ff08.png | |
this.position = | |
{ | |
x: self.vpc.x + Math.cos(time * 0.002) * this.helpers.sineBetween(-200, 200, time * 0.02), | |
y: self.vpc.y + Math.sin(time * 0.002) * this.helpers.sineBetween(200, 200, time * 0.02) | |
} | |
this.viewportsize = viewportsize; | |
this.vpc = { x: this.viewportsize.w / 2, y: this.viewportsize.h / 2 }; // Viewportcenter |
This file contains hidden or 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
* | |
{ | |
margin: 0; | |
padding: 0; | |
} | |
html, body | |
{ | |
width: 100%; | |
height: 100%; |
This file contains hidden or 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
function toCharcodes(str) | |
{ | |
var codestring = ''; | |
var comma = ''; | |
for(var i = 0; i < str.length; i++) | |
{ | |
comma = (i === str.length-1) ? '' : ','; | |
codestring += str.charCodeAt(i) + comma; | |
} |
This file contains hidden or 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
function sineBetween(min, max, t) | |
{ | |
var halfRange = (max - min) / 2; | |
return min + halfRange + Math.sin(t) * halfRange; | |
} | |
function cosineBetween(min, max, t) | |
{ | |
var halfRange = (max - min) / 2; | |
return min + halfRange + Math.cos(t) * halfRange; |
This file contains hidden or 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
function Line(from, to, color, thickness) | |
{ | |
this.from = from || { x: 0, y: 0 }; | |
this.to = to || { x: 100, y: 100 }; | |
// Aliases for from and to | |
this.p1 = this.from; | |
this.p2 = this.to; | |
this.color = color || 'black'; |
NewerOlder