Skip to content

Commit

Permalink
Calculate dots according to screen resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Giel Berkers committed Mar 7, 2013
1 parent 14ce6f1 commit e753b9e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions assets/javascripts/views/dots-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ siteApp.views.push({
// Stepping function:
stepFunction : function(ctx, vars){
ctx.clearRect(0, 0, ctx.width, ctx.height);
var stepsX = ctx.width / 50;
var stepsY = ctx.height / 50;
var stepSize = ctx.width / 15;
var stepsX = ctx.width / stepSize;
var stepsY = ctx.height / stepSize;

for(var y = 0; y < stepsY; y ++)
{
for(var x = 0; x < stepsX; x ++)
{
var cX = (y%2 * 25) + (x * 50);
var cY = y * 50;
var cX = (y%2 * stepSize * 2) + (x * stepSize);
var cY = y * stepSize;

// outside:
var rad = Math.atan2(cX - vars.mousePosition.x, cY - vars.mousePosition.y);
Expand Down

0 comments on commit e753b9e

Please sign in to comment.