Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- Shader Collab
 * By eliza & ilithya | 2020
 *
 * https://www.elizasj.com/
 * https://twitter.com/iamelizasj
 *
 * https://www.ilithya.rocks/
 * https://twitter.com/ilithya_rocks -->

<div id="shadercollab"></div>
<script id="vertex" type="x-shader/x-vertex">
	void main() { gl_Position = vec4(position, 1.0); }
</script>

<script id="fragment" type="x-shader/x-fragment">
precision highp float;

uniform vec2 u_resolution;
uniform float u_time;
	
#define PI 3.14159265359

// Pallete function by Inigo Quilez - iquilezles.org
vec3 palette(in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d) { return a + b*cos( 6.28318*(c*t+d) ); }
			
void main() {
	vec2 uv = gl_FragCoord.xy/u_resolution.xy;
	uv.x *= u_resolution.x/u_resolution.y;

	float wave = PI * 2.;
	float anim_01 = sin(u_time/1.5);
	float anim_02 = cos(u_time/2.5);
	float size = 2.15;
	float amount = 1.73;

	/* Frequency is the combiantion of oscilation and phase. */
	/* Oscillation is the repetitive variation. */
	/* Phase is an angle representing the number of periods spanned by that variable. */
	
	vec3 color_palette = palette(
		.5, // Keep the color spectrum balanced
		vec3(fract(sin(uv.x*wave)*anim_01 * size + cos(uv.y*wave)*anim_02*amount + uv.yyx)), // shape 
		vec3(fract(cos(uv.x*wave)*anim_02 * size + sin(uv.y*wave)*anim_01*amount + uv.xxy)), // mirror shape
		vec3(sin(u_time/2.)/2., .06, 1.0), // Color
		vec3(.5) // Keep the color spectrum balanced
	);	
	
	gl_FragColor = vec4(color_palette, 1.0);
}
</script>	
              
            
!

CSS

              
                $c1: #1301FF; // blue

* {
	user-select: none;
}

body {
	height: 100vh;
	background-color: $c1;
	margin: 0;
	padding: 0;
	overflow: hidden;
	position: relative;
}
              
            
!

JS

              
                /* 
 * COLLAB — ELIZA & ILITHYA
 * 2_MOVEMENT 🌊
 *
 * OCT 2020
 *
 * https://www.elizasj.com/
 * https://twitter.com/iamelizasj
 *
 * https://www.ilithya.rocks/
 * https://twitter.com/ilithya_rocks
 */

let camera, scene, renderer, clock;
let uniforms;

function init() {
	const container = document.getElementById("shadercollab");

	clock = new THREE.Clock();
	camera = new THREE.Camera();
	camera.position.z = 1;

	scene = new THREE.Scene();

	const geometry = new THREE.PlaneBufferGeometry(2, 2);

	uniforms = {
		u_time: { type: "f", value: 1.0 },
		u_resolution: { type: "v2", value: new THREE.Vector2() },
	};

	const material = new THREE.ShaderMaterial({
		uniforms,
		vertexShader: document.getElementById("vertex").textContent,
		fragmentShader: document.getElementById("fragment").textContent
	});

	const mesh = new THREE.Mesh(geometry, material);
	scene.add(mesh);

	renderer = new THREE.WebGLRenderer();
	renderer.setPixelRatio(window.devicePixelRatio);

	container.appendChild(renderer.domElement);

	onWindowResize();
	window.addEventListener("resize", onWindowResize);
}

function onWindowResize() {
	renderer.setSize(window.innerWidth, window.innerHeight);
	uniforms.u_resolution.value.x = renderer.domElement.width;
	uniforms.u_resolution.value.y = renderer.domElement.height;
}

function render() {
	uniforms.u_time.value = clock.getElapsedTime();
	renderer.render(scene, camera);
}

function animate() {
	render();
	requestAnimationFrame(animate);
}

init();
animate();
              
            
!
999px

Console