FillStyleLinearGradient.js 504 B

123456789101112131415161718
  1. class FillStyleLinearGradient {
  2. constructor(x0, y0, x1, y1) {
  3. this._start_pos = { _x: x0, _y: y0 };
  4. this._end_pos = { _x: x1, _y: y1 };
  5. this._stop_count = 0;
  6. this._stops = [0, 0, 0, 0, 0];
  7. }
  8. addColorStop = function (pos, color) {
  9. if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) {
  10. this._stops[this._stop_count] = { _pos: pos, _color: color };
  11. this._stop_count++;
  12. }
  13. }
  14. }
  15. export default FillStyleLinearGradient;