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

Function pinch

pattern/canvas.js:3403–3414  ·  view source on GitHub ↗
(img, dx, dy, zoom)

Source from the content-addressed store, hash-verified

3401}
3402
3403function pinch(img, dx, dy, zoom) {
3404 /* Returns the image with a pinch distortion applied to it.
3405 * - dx: horizontal offset (in pixels) of the effect.
3406 * - dy: vertical offset (in pixels) of the effect.
3407 * - zoom: the amount of bulge or pinch (-1.0-1.0):
3408 */
3409 var m1 = geometry.distance(0, 0, img.width, img.height);
3410 var m2 = Math.clamp(zoom || 0 * 0.75, -0.75, 0.75);
3411 return polar(img, dx, dy, function(d, a) {
3412 return [d * Math.pow(m1/d, m2) * (1-m2), a];
3413 });
3414}
3415
3416function splash(img, dx, dy, radius) {
3417 /* Returns the image with a light-tunnel distortion applied to it.

Callers 1

distortFunction · 0.85

Calls 2

polarFunction · 0.85
distanceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…