Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 3, 2017 01:34 pm GMT

Randomizing SVG Shapes

SVG shapes are all built from numbers. Obvious, perhaps, but also, I'm not sure we take as much advantage of that as we could with inline <svg>. For example, it's pretty easy to generate a new pseudo-random number in JavaScript:

function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}

Now imagine a bunch of variables set to random numbers, and using ES6 template literals to stitch them together:

let newPoints = `${x1},${y1} {x2},${y2}


Randomizing SVG Shapes is a post from CSS-Tricks


Original Link: http://mediatemple.net/blog/tips/randomizing-svg-shapes/

Share this article:    Share on Facebook
View Full Article

CSS Tricks

A Web Design Community curated by Chris Coyier

More About this Source Visit CSS Tricks