Last active
November 13, 2019 18:00
-
-
Save brunosimon/389129c84e8488e30bf8ed0d5e9fc12b to your computer and use it in GitHub Desktop.
Folio 2019 - Medium article - Floor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const topLeft = new THREE.Color(0x00ffff) | |
const topRight = new THREE.Color(0xffffff) | |
const bottomRight = new THREE.Color(0xff00ff) | |
const bottomLeft = new THREE.Color(0x0000ff) | |
const data = new Uint8Array([ | |
Math.round(bottomLeft.r * 255), Math.round(bottomLeft.g * 255), Math.round(bottomLeft.b * 255), | |
Math.round(bottomRight.r * 255), Math.round(bottomRight.g * 255), Math.round(bottomRight.b * 255), | |
Math.round(topLeft.r * 255), Math.round(topLeft.g * 255), Math.round(topLeft.b * 255), | |
Math.round(topRight.r * 255), Math.round(topRight.g * 255), Math.round(topRight.b * 255) | |
]) | |
const backgroundTexture = new THREE.DataTexture(data, 2, 2, THREE.RGBFormat) | |
backgroundTexture.magFilter = THREE.LinearFilter | |
backgroundTexture.needsUpdate = true | |
material.uniforms.tBackground.value = backgroundTexture |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment