cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <a href="https://twitter.com/not__robin" target="_blank">ENTER</a>

<script id="vertexShader" type="x-shader/x-vertex">
	varying vec2 vUv;
	void main() {
		vUv = uv;
		gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
	}
</script>

<script id="fragmentShader" type="x-shader/x-fragment">
	uniform sampler2D _circle;
	uniform sampler2D _circle_blur;
	uniform sampler2D _dist;
	uniform sampler2D _mask;
	uniform sampler2D _color;
	uniform float _time;
	varying vec2 vUv;

	//custom
	uniform float _dispFactor;
	uniform float _speed;

	float map(float value, float minA, float maxA, float minB, float maxB){
			return (value - minA) / (maxA - minA) * (maxB - minB) + minB;
	}

	void main()	{

		vec2 uv = vUv;

		vec4 circleTexture = texture2D( _mask, uv );

			vec2 scaleCenter = vec2(0.5, 0.5);

			vec2 coord = uv;
			float sin_factor = sin(0.72 * _time);
			float cos_factor = cos(0.72 * _time);
			coord = vec2(coord.x - 0.5, coord.y - 0.5) * mat2(cos_factor, sin_factor, -sin_factor, cos_factor);
			coord += 0.5;


			vec2 distMapUV = uv * 0.22;
			distMapUV.y -= _time / _speed;

			vec4 mapColorDisp = texture2D( _color, (coord - scaleCenter) * 0.7 + scaleCenter );
			vec4 mapDisp = texture2D( _dist, distMapUV);// - 0.75;

			float xDisp = map( mapColorDisp.x, 0.0, 1.0, -1.0, 1.0 ) * mapDisp.x * _dispFactor;
			float yDisp = map( mapColorDisp.y, 0.0, 1.0, -1.0, 1.0 ) * mapDisp.x * _dispFactor;

			vec2 uvDisp = vec2(
					clamp( xDisp * 0.3448 * circleTexture.a, -0.1, 0.1 ),
					clamp( yDisp * 0.3448 * circleTexture.a, -0.1, 0.1 )
			);

			float maskCircle = circleTexture.a * 1.8;

		vec2 scaledUV = vec2((uv - scaleCenter) * 1.5 + scaleCenter );

			vec4 tex_light = texture2D( _circle, scaledUV + uvDisp * coord * 1.5);
			vec4 tex_lightBlur = texture2D( _circle_blur, scaledUV + uvDisp * coord * 1.5);
			tex_lightBlur.a *= (8.41 * circleTexture.a);
		tex_lightBlur.rgb *= 2.2;
			tex_light.rgb *= 1.6 * max((1.0 - maskCircle), .0);


		gl_FragColor = mix(tex_light, tex_lightBlur, min(maskCircle, 1.0));
	}
</script>
            
          
!
            
              body {
	margin: 0;
	overflow: hidden;
	position: fixed;
}
canvas {
	width: 100%;
	height: 100%;
}
a {
	text-decoration: none;
	position: absolute;
	color: rgba(255, 255, 255, 0.9);
	font-weight: 100;
	font-size: 20px;
	font-family: "helvetica";
	letter-spacing: 8px;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	transition: color 0.6s ease;
	padding: 130px 90px;
	border-radius: 50%;
}
a:hover {
	color: rgba(255, 255, 255, 0.4);
	transition: color 0.6s ease;
}

            
          
!
            
              var mobileAndTabletcheck = function() {
	var check = false;
	(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
	return check;
};

var canvas = document.createElement( 'canvas' );
var ctx = canvas.getContext( '2d' );

var w = 320;
var h = 320;

var width = window.innerWidth;
var height = window.innerHeight;

var planeSize = 600;

var radius = 300;

if(mobileAndTabletcheck()){
	planeSize = 400;
	w = 200;
	h = 200;
	radius = 150;
}

canvas.setAttribute('width', w);
canvas.setAttribute('height', h);

// canvas.style.position = 'absolute';
// canvas.style.width = '320px';
// canvas.style.height = '320px';
// canvas.style.top = '0';
// canvas.style.left = '0';
// canvas.style.zIndex = '100';
// document.body.appendChild(canvas);

window.addEventListener('resize', onWindowResize);

var maskImage = new Image();
// maskImage.src = "https://robindelaporte.fr/codepen/codevember/circle_disp.png";
//because of tainted canvas
maskImage.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIH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[0, 0];

var raycaster = new THREE.Raycaster();
var mouse = new THREE.Vector2();

if(mobileAndTabletcheck()){
	window.addEventListener('touchmove', function(e){
		mouse.x = ( e.touches[0].clientX / window.innerWidth ) * 2 - 1;
		mouse.y = - ( e.touches[0].clientY / window.innerHeight ) * 2 + 1;
	});
	} else {
	window.addEventListener('mousemove', function(e){
		mouse.x = ( e.clientX / window.innerWidth ) * 2 - 1;
		mouse.y = - ( e.clientY / window.innerHeight ) * 2 + 1;
	});
}

function renderRay() {
	raycaster.setFromCamera( mouse, camera );
	var intersects = raycaster.intersectObjects( scene.children );
	for ( var i = 0; i < intersects.length; i++ ) {
		mousePos[0] = (((intersects[i].point.x / planeSize)+ 0.5) * w) - (radius*0.5);
		mousePos[1] = ((((intersects[i].point.y * -1) / planeSize)+ 0.5) * h) - (radius*0.5);
	}
}


function draw(){
	ctx.clearRect(0, 0, w, h);
	ctx.drawImage(maskImage, mousePos[0], mousePos[1], radius, radius);
	renderRay();
}

var frustumSize = 600;
var aspect = window.innerWidth / window.innerHeight;


var clock = new THREE.Clock(true);

var scene = new THREE.Scene();
camera = new THREE.OrthographicCamera( frustumSize * aspect / - 2, frustumSize * aspect / 2, frustumSize / 2, frustumSize / - 2, 1, 2000 );

camera.lookAt(scene.position);
camera.position.z = 1;


var renderer = new THREE.WebGLRenderer({
	antialias: true,
	alpha: true
});
renderer.setPixelRatio = 1;
renderer.setClearColor(0x3A405A, 1.0);
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );

function onWindowResize(){

var aspect = window.innerWidth / window.innerHeight;

camera.left   = - frustumSize * aspect / 2;
camera.right  =   frustumSize * aspect / 2;
camera.top    =   frustumSize / 2;
camera.bottom = - frustumSize / 2;

camera.updateProjectionMatrix();

renderer.setSize( window.innerWidth, window.innerHeight );
}

var gui = new dat.GUI();
var params = {
	dispFactor: 0.238,
	speed: 24.0,
};

gui.add(params, 'dispFactor', 0, 1).step(0.001).onChange(function( value ) {
	object.material.uniforms._dispFactor.value = value;
	object.material.uniforms._dispFactor.needsUpdate = true;
});
gui.add(params, 'speed', 1, 50).step(1).onChange(function( value ) {
	object.material.uniforms._speed.value = value;
	object.material.uniforms._speed.needsUpdate = true;
});

// var controls = new THREE.OrbitControls( camera, renderer.domElement );

var loader = new THREE.TextureLoader();
loader.crossOrigin = '';
var circle = loader.load('https://robindelaporte.fr/codepen/codevember/circle.png');
var circle_blur = loader.load('https://robindelaporte.fr/codepen/codevember/circle_blur.png');
var color = loader.load('https://robindelaporte.fr/codepen/codevember/map_light_disp_color.png');
var dist = loader.load('https://robindelaporte.fr/codepen/codevember/dist_c.jpg');

dist.wrapS = dist.wrapT = THREE.RepeatWrapping;
color.wrapS = color.wrapT = THREE.RepeatWrapping;

var mask = new THREE.Texture(canvas);
mask.minFilter = THREE.LinearFilter;

var mat = new THREE.ShaderMaterial({
	uniforms: {
		_time: { type: "f", value: 1.0 },
		_mask: { type: 't', value: mask },
		_color: { type: 't', value: color },
		_circle: { type: 't', value: circle },
		_circle_blur: { type: 't', value: circle_blur },
		_dist: { type: 't', value: dist },

		_dispFactor: { type: "f", value: params.dispFactor },
		_speed: { type: "f", value: params.speed }
	},

	vertexShader: document.getElementById( 'vertexShader' ).textContent,
	fragmentShader: document.getElementById( 'fragmentShader' ).textContent,
	transparent: true,
	opacity: 1.0,
	blending: THREE.AdditiveBlending
});

var geometry = new THREE.PlaneBufferGeometry( planeSize, planeSize, 1 );
var object = new THREE.Mesh(geometry, mat);
scene.add(object);

window.addEventListener('click', function(){
});


var animate = function () {
	requestAnimationFrame( animate );
	renderer.render(scene, camera);

	var d = clock.getDelta();
	mat.uniforms._time.value += d;

	mask.needsUpdate = true;

	draw();
};
animate();
            
          
!
999px
Loading ..................

Console