0.3.3 • Published 6 years ago
samai v0.3.3
Samai
Pseudo-randomly generated patterns inspired by the Kente cloth tradition of Ghana.
Example
var options = {
date: new Date('01-18-2018'),
width: 400,
dark_colors: ['#900', '#072'],
light_colors: ['#AA6', '#990', '#222'],
fabric_enabled: true,
n: 37
};
var samai = new Samai(options);
var body = document.querySelector('body');
samai.getPNG().then(src => {
body.style.backgroundSize = samai.width + 'px';
body.style.background = "url('" + src + "')";
});
This code produces the following pattern:
Dependencies
Documentation
Check the jsdoc for more information.