Last active
December 27, 2016 04:55
-
-
Save partkyle/9eb0592148ed042071af87b11546327c to your computer and use it in GitHub Desktop.
Something fun for places like http://secretagentcomingthrough.com/. Example: http://imgur.com/a/PGZlc
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 doit(screenHeight, screenWidth) { | |
// override the random to make it always gold | |
Math.random = function() { return 1; } | |
// remnants of a time when I cared about where it started looping from | |
var startX = 0; | |
var startY = 0; | |
// there is a margin for the card. I can't be bothered to figure it out | |
// so just taking about 20% off makes a nice overlap | |
var cardWidth = 286 * .8; | |
var cardHeight = 395 * .8; | |
// these will probably work for most people | |
screenHeight = screenHeight || 1080; | |
screenWidth = screenWidth || 1920; | |
// loop the loop | |
for (var currentX = startX; currentX <= screenWidth; currentX += cardWidth) { | |
for (var currentY = startY; currentY <= screenHeight; currentY += cardHeight) { | |
addImage({clientX: currentX, clientY: currentY}); | |
} | |
} | |
} | |
doit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment