MCPcopy
hub / github.com/tdewolff/minify / createLinearGradient

Function createLinearGradient

_benchmarks/sample_echarts.js:26499–26516  ·  view source on GitHub ↗
(ctx, obj, rect)

Source from the content-addressed store, hash-verified

26497 }
26498
26499 function createLinearGradient(ctx, obj, rect) {
26500 var x = obj.x == null ? 0 : obj.x;
26501 var x2 = obj.x2 == null ? 1 : obj.x2;
26502 var y = obj.y == null ? 0 : obj.y;
26503 var y2 = obj.y2 == null ? 0 : obj.y2;
26504 if (!obj.global) {
26505 x = x * rect.width + rect.x;
26506 x2 = x2 * rect.width + rect.x;
26507 y = y * rect.height + rect.y;
26508 y2 = y2 * rect.height + rect.y;
26509 }
26510 x = isNaN(x) ? 0 : x;
26511 x2 = isNaN(x2) ? 1 : x2;
26512 y = isNaN(y) ? 0 : y;
26513 y2 = isNaN(y2) ? 0 : y2;
26514 var canvasGradient = ctx.createLinearGradient(x, y, x2, y2);
26515 return canvasGradient;
26516 }
26517 function createRadialGradient(ctx, obj, rect) {
26518 var width = rect.width;
26519 var height = rect.height;

Callers 1

getCanvasGradientFunction · 0.85

Calls 1

isNaNFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…