Created
December 24, 2015 14:17
-
-
Save audinue/a08d91f892cc0aa3a87e to your computer and use it in GitHub Desktop.
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
var x = scroll.x; | |
var y = scroll.y; | |
var minX = undefined, maxX = undefined; | |
var minY = undefined, maxY = undefined; | |
if(x < 0) { | |
while(x < paisley.width) { | |
if(x > -paisley.width) { | |
if(minX === undefined) { | |
minX = x; | |
} | |
} | |
x += paisley.width; | |
} | |
maxX = x; | |
} else { | |
while(x > -paisley.width) { | |
if(x < paisley.width) { | |
if(maxX === undefined) { | |
maxX = x; | |
} | |
} | |
x -= paisley.width; | |
} | |
minX = x; | |
} | |
if(y < 0) { | |
while(y < paisley.height) { | |
if(y > -paisley.height) { | |
if(minY === undefined) { | |
minY = y; | |
} | |
} | |
y += paisley.height; | |
} | |
maxY = y; | |
} else { | |
while(y > -paisley.height) { | |
if(y < paisley.height) { | |
if(maxY === undefined) { | |
maxY = y; | |
} | |
} | |
y -= paisley.height; | |
} | |
minY = y; | |
} | |
while(minX <= maxX) { | |
var y = minY; | |
while(y <= maxY) { | |
ctx.drawImage(paisley, minX, y); | |
y += paisley.height; | |
} | |
minX += paisley.width; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment