MCPcopy Index your code
hub / github.com/clips/pattern / twirl

Function twirl

pattern/canvas.js:3428–3440  ·  view source on GitHub ↗
(img, dx, dy, radius, angle)

Source from the content-addressed store, hash-verified

3426}
3427
3428function twirl(img, dx, dy, radius, angle) {
3429 /* Returns the image with a twirl distortion applied to it.
3430 * - dx: horizontal offset (in pixels) of the effect.
3431 * - dy: vertical offset (in pixels) of the effect.
3432 * - radius: the radius of the effect in pixels.
3433 * - angle: the amount of rotation in degrees.
3434 */
3435 var m1 = Math.radians(angle || 0);
3436 var m2 = radius || 0;
3437 return polar(img, dx, dy, function(d, a) {
3438 return [d, a + (1 - geometry.smoothstep(-m2, m2, d)) * m1];
3439 });
3440}
3441
3442var BUMP = "bump";
3443var DENT = "dent";

Callers 1

distortFunction · 0.85

Calls 1

polarFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…