| 3373 | } |
| 3374 | |
| 3375 | function bump(img, dx, dy, radius, zoom) { |
| 3376 | /* Returns the image with a dent distortion applied to it. |
| 3377 | * - dx: horizontal offset (in pixels) of the effect. |
| 3378 | * - dy: vertical offset (in pixels) of the effect. |
| 3379 | * - radius: the radius of the effect in pixels. |
| 3380 | * - zoom: the amount of bulge (0.0-1.0). |
| 3381 | */ |
| 3382 | var m1 = radius || 0; |
| 3383 | var m2 = Math.clamp(zoom || 0, 0, 1); |
| 3384 | return polar(img, dx, dy, function(d, a) { |
| 3385 | return [d * geometry.smoothstep(0, m2, d/m1), a]; |
| 3386 | }); |
| 3387 | } |
| 3388 | |
| 3389 | function dent(img, dx, dy, radius, zoom) { |
| 3390 | /* Returns the image with a dent distortion applied to it. |