We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5560793 commit 1bb5b95Copy full SHA for 1bb5b95
src/core/GradientTexture.tsx
@@ -1,13 +1,15 @@
1
import * as React from 'react'
2
import { useThree } from '@react-three/fiber'
3
+import * as THREE from 'three'
4
+
5
export enum GradientType {
6
Linear = 'linear',
7
Radial = 'radial',
8
}
9
10
type Props = {
11
stops: Array<number>
- colors: Array<string>
12
+ colors: Array<THREE.ColorRepresentation>
13
attach?: string
14
size?: number
15
width?: number
@@ -53,9 +55,10 @@ export function GradientTexture({
53
55
)
54
56
57
58
+ const tempColor = new THREE.Color() // reuse instance for performance
59
let i = stops.length
60
while (i--) {
- gradient.addColorStop(stops[i], colors[i])
61
+ gradient.addColorStop(stops[i], tempColor.set(colors[i]).getStyle())
62
63
context.save()
64
context.fillStyle = gradient
0 commit comments