diff --git a/src/core/shaders/canvas/LinearGradient.ts b/src/core/shaders/canvas/LinearGradient.ts index 9da24aab6..9bb61c3c3 100644 --- a/src/core/shaders/canvas/LinearGradient.ts +++ b/src/core/shaders/canvas/LinearGradient.ts @@ -43,13 +43,13 @@ export const LinearGradient: CanvasShaderType< Math.abs(nHeight * Math.cos(angle))) * 0.5; - this.computed = { - x0: line * Math.cos(angle) + nWidth * 0.5, - y0: line * Math.sin(angle) + nHeight * 0.5, - x1: line * Math.cos(angle + Math.PI) + nWidth * 0.5, - y1: line * Math.sin(angle + Math.PI) + nHeight * 0.5, - colors: this.props!.colors.map((value) => this.toColorString(value)), - }; + this.computed.x0 = line * Math.cos(angle) + nWidth * 0.5; + this.computed.y0 = line * Math.sin(angle) + nHeight * 0.5; + this.computed.x1 = line * Math.cos(angle + Math.PI) + nWidth * 0.5; + this.computed.y1 = line * Math.sin(angle + Math.PI) + nHeight * 0.5; + this.computed.colors = this.props!.colors.map((value) => + this.toColorString(value), + ); }, render(ctx, node, renderContext) { renderContext(); diff --git a/src/core/shaders/canvas/RadialGradient.ts b/src/core/shaders/canvas/RadialGradient.ts index 604fffdc4..9d251955d 100644 --- a/src/core/shaders/canvas/RadialGradient.ts +++ b/src/core/shaders/canvas/RadialGradient.ts @@ -47,14 +47,14 @@ export const RadialGradient: CanvasShaderType< scaleY = pHeight / pWidth; } - this.computed = { - pivotX: props.pivot[0] * node.w, - pivotY: props.pivot[1] * node.h, - scaleX, - scaleY, - size: Math.min(pWidth, pHeight), - colors: props.colors.map((value) => this.toColorString(value)), - }; + this.computed.pivotX = props.pivot[0] * node.w; + this.computed.pivotY = props.pivot[1] * node.h; + this.computed.scaleX = scaleX; + this.computed.scaleY = scaleY; + this.computed.size = Math.min(pWidth, pHeight); + this.computed.colors = props.colors.map((value) => + this.toColorString(value), + ); }, render(ctx, node, renderContext) { renderContext();