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

Function distort

pattern/canvas.js:3448–3467  ·  view source on GitHub ↗
(mode, img, options)

Source from the content-addressed store, hash-verified

3446var TWIRL = "twirl";
3447
3448function distort(mode, img, options) {
3449 /* Applies the given distortion and returns a new image.
3450 * Optional parameters are dx, dy, radius, zoom and angle.
3451 */
3452 var o = options || {};
3453 switch (mode) {
3454 case BUMP:
3455 return bump(img, o.dx, o.dy, o.radius, o.zoom);
3456 case DENT:
3457 return dent(img, o.dx, o.dy, o.radius, o.zoom);
3458 case PINCH:
3459 return pinch(img, o.dx, o.dy, o.zoom);
3460 case SPLASH:
3461 return splash(img, o.dx, o.dy, o.radius);
3462 case TWIRL:
3463 return twirl(img, o.dx, o.dy, o.radius, o.angle);
3464 default:
3465 return img;
3466 }
3467}
3468
3469/*##################################################################################################*/
3470

Callers

nothing calls this directly

Calls 5

bumpFunction · 0.85
dentFunction · 0.85
pinchFunction · 0.85
splashFunction · 0.85
twirlFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…