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

Function dent

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

Source from the content-addressed store, hash-verified

3387}
3388
3389function dent(img, dx, dy, radius, zoom) {
3390 /* Returns the image with a dent distortion applied to it.
3391 * - dx: horizontal offset (in pixels) of the effect.
3392 * - dy: vertical offset (in pixels) of the effect.
3393 * - radius: the radius of the effect in pixels.
3394 * - zoom: the amount of pinch (0.0-1.0).
3395 */
3396 var m1 = radius || 0;
3397 var m2 = Math.clamp(zoom || 0, 0, 1);
3398 return polar(img, dx, dy, function(d, a) {
3399 return [2 * d - d * geometry.smoothstep(0, m2, d/m1), a];
3400 });
3401}
3402
3403function pinch(img, dx, dy, zoom) {
3404 /* Returns the image with a pinch distortion applied to it.

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…