Last active
September 29, 2016 22:17
-
-
Save coffeepostal/e236de380cc49448227eb3f82d339e78 to your computer and use it in GitHub Desktop.
JS: Trianglify Settings
This file contains 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
// Multiple DIVs as a true background-image | |
function addTriangleTo(target) { | |
var dimensions = target.getClientRects()[0]; | |
var pattern = Trianglify({ | |
width: dimensions.width, | |
height: dimensions.height | |
}); | |
target.style['background-image'] = 'url(' + pattern.png() + ')'; | |
} | |
addTriangleTo(document.getElementById('something')); | |
addTriangleTo(document.getElementById('other')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment