Skip to content

Commit

Permalink
canvas getContext add willReadFrequently
Browse files Browse the repository at this point in the history
  • Loading branch information
deyihu committed Nov 1, 2024
1 parent 40fda7f commit 168b97a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ColorIn {
const { width, height } = this.options;
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext('2d');
const ctx = canvas.getContext('2d', { willReadFrequently: true });
ctx.clearRect(0, 0, canvas.width, canvas.height);
const gradient = ctx.createLinearGradient(0, 0, canvas.width, 0);
const { colors, valueOffset } = this;
Expand Down

0 comments on commit 168b97a

Please sign in to comment.