| /** | /** | ||||
| * | * | ||||
| * @returns {string|undefined} | |||||
| * @returns {HTMLCanvasElement|undefined} | |||||
| * @private | * @private | ||||
| */ | */ | ||||
| _createGradientTexture() { | _createGradientTexture() { | ||||
| let ctx = canvas.getContext('2d') | let ctx = canvas.getContext('2d') | ||||
| let grd = ctx.createLinearGradient(0, 0, 200, 0) | let grd = ctx.createLinearGradient(0, 0, 200, 0) | ||||
| for (let key in this._options.gradient) { | for (let key in this._options.gradient) { | ||||
| grd.addColorStop(+key, this._options.gradient[+key]) | |||||
| grd.addColorStop(+key, this._options.gradient[key]) | |||||
| } | } | ||||
| ctx.fillStyle = grd | ctx.fillStyle = grd | ||||
| ctx.fillRect(0, 0, 200, 10) | ctx.fillRect(0, 0, 200, 10) | ||||
| return canvas.toDataURL() | |||||
| return canvas | |||||
| } | } | ||||
| /** | /** |