g.js — graphical objects for JavaScript

wigglePointswigglePoints

Shift points of the shape by a random amount.

var e = g.star({x: 0, y: 0}, 5, 100, 20);
g.wigglePoints(e, 5, 42);

g.wiggle is often used in combination with g.resample to make shapes look hand-drawn:

var e = g.ellipse(0, 0, 100, 100);
var r = g.resampleByLength(e, 3);
g.wigglePoints(r, 2, 42);

Parameters

  • shape: The input shape.
  • offset: The maximum amount of translation.
  • seed: The random variation.

See Also