Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <html>
	<head>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<title>[Click]</title>
		<style>
			body {
				margin: 0px;
    			overflow: hidden; 
    			background-color: #779ECB;
    			font-family: 'Arial';
    		}

			.char {
			  font-size: 100px;
			  transform-origin: center;
			  color: white;
			}
			
			#help{
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%, -50%);
				font-size: 40px;
				color: black;
			}

		</style>

	</head>
	<body>
		<div id="help">[click]</div>
	</body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                //created by XORXOR, 2016

var contianer, renderer, camera, scene;
var char;
var chars = [];
var objects = [];


function init() {

    container = document.createElement('div');
    document.body.appendChild(container);

    scene = new THREE.Scene();
    camera = new THREE.PerspectiveCamera( 70, window.innerWidth/window.innerHeight, 1, 10000 );
    camera.position.set( 0, 0, 500 );
    
    renderer = new THREE.CSS3DRenderer();

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

    container.appendChild( renderer.domElement );
    scene.add(camera);

    window.addEventListener( 'mousedown', clickedOnScreen );
    window.addEventListener( 'resize', onWindowResize, false );
}

function get3dPoint(event){
    var vector = new THREE.Vector3(
        (event.clientX / window.innerWidth) * 2 - 1,
        - (event.clientY / window.innerHeight) * 2 + 1,
        0.5);

    vector.unproject(camera);
    var dir = vector.sub(camera.position).normalize();
    var distance = - camera.position.z / dir.z;
    var pos = camera.position.clone().add( dir.multiplyScalar(distance) );    
    return pos;
}
            
function animate() {
    
    for (var i = chars.length - 1; i >= 0; i--) { 
        chars[i].style.opacity -= .004;      
        op = chars[i].style.opacity;
        objects[i].position.z -= 1;

        if (op < 0) {
            scene.remove(objects[i]);
            chars.splice(i,1);
            objects.splice(i,1);
        }
    }
    
    requestAnimationFrame(animate);
    renderer.render(scene, camera);
}


function clickedOnScreen(e) {
    e.preventDefault();  

    var help = document.getElementById('help');
    help.style.display = "none";

    var point = get3dPoint(e);    

    char = document.createElement( 'div' );
    char.className = 'char';
    char.style.opacity = 1;
    letter = String.fromCharCode(97 + Math.floor(Math.random() * 26))

    char.textContent = letter.toUpperCase();    
    object = new THREE.CSS3DObject(char);

    chars.push(char);
    objects.push(object);

    scene.add(object);

    object.position.set(point.x,point.y,0)   
}

function onWindowResize() {
    camera.aspect = window.innerWidth / window.innerHeight;
    camera.updateProjectionMatrix();
    renderer.setSize( window.innerWidth, window.innerHeight );
}

init();
animate();
              
            
!
999px

Console