Skip to content

Instantly share code, notes, and snippets.

@drewlustro
Created October 7, 2014 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewlustro/cb79dfa86d6adc19a928 to your computer and use it in GitHub Desktop.
Save drewlustro/cb79dfa86d6adc19a928 to your computer and use it in GitHub Desktop.
(function() {
define('shaders/ColorWheel.shader', [] , function () {
return {
uniforms: {
time: { type: 'f', value: 0.0 }
},
fragmentShader: [
"uniform float time;",
"varying vec2 vUv;",
"void main() {",
"vec2 position = -1.0 + 2.0 * vUv;",
"float red = abs(tan(position.x * position.y + time / 60.0));",
"float green = abs(tan(position.x * position.y + time / 20.0));",
"float blue = abs(tan(position.x * position.y + time / 5.0 ));",
"gl_FragColor = vec4(red, green, blue, 0.5);",
"}"].join("\n"),
vertexShader: [
"uniform float time;",
"varying vec2 vUv;",
"void main() {",
"vUv = uv;",
"vec3 newPosition = position + normal * vec3(sin(time * 0.2) * 3.0);",
"gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);",
"}"
].join("\n")
};
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment