Skip to content

Commit

Permalink
fix: add willReadFrequently prop to canvas context
Browse files Browse the repository at this point in the history
  • Loading branch information
loke-dev committed Jul 10, 2023
1 parent e412ccd commit 5d8fdf5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/components/Hero.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
}
const initCanvas = (canvas: HTMLCanvasElement) => {
const ctx = canvas.getContext("2d")
const ctx = canvas.getContext("2d", { willReadFrequently: true })
const gradientWidth = 500
let gradient = ctx.createLinearGradient(0, 0, gradientWidth, 0)
Expand All @@ -141,7 +141,7 @@
return
}
const ctx = canvas.getContext("2d")
const ctx = canvas.getContext("2d", { willReadFrequently: true })
let needsUpdate = false
ctx.clearRect(0, 0, canvas.width, canvas.height)
Expand Down

0 comments on commit 5d8fdf5

Please sign in to comment.