export const textureGradient = (width, height, color1, color2) => { const cnv = document.createElement("canvas"); const ctx = cnv.getContext("2d"); ctx.rect(0, 0, cnv.width, cnv.height); const gradient = ctx.createLinearGradient(0, 0, width / 4, 15 * height); gradient.addColorStop(0, color1); gradient.addColorStop(1, color2); ctx.fillStyle = gradient; ctx.fill(); const texture = new THREE.Texture(cnv); texture.needsUpdate = true; return texture; };