Retro Neon

HTML
<div id='stats'></div> <canvas id='canvas'></canvas> <script src='https://cdnjs.cloudflare.com/ajax/libs/three.js/84/three.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js'></script> <script src='http://cdnjs.cloudflare.com/ajax/libs/stats.js/r11/Stats.min.js'></script> <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-18/EffectComposer.js'></script> <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-18/ShaderPass.js'></script> <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-18/RenderPass.js'></script> <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-18/CopyShader.js'></script> <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-18/MaskPass.js'></script> <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-18/GlitchPass.js'></script> <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-18/DigitalGlitch.js'></script>
STYLUS
* *:before *:after margin: 0 padding: 0 html body width: 100% height: 100% overflow: hidden background: #111
COFFEE
canvas = document.getElementById 'canvas' ctrl = rotationX: .003 rotationY: .003 scale: 1400 # GUI gui = new dat.GUI() gui.add ctrl, 'rotationX', -.1, .1, .001 gui.add ctrl, 'rotationY', -.1, .1, .001 gui.add ctrl, 'scale', -300, 2000, 20 # Stats (FPS meter) stats = new Stats() stats.setMode 0 stats.domElement.style.position = 'absolute' stats.domElement.style.left = '15px' stats.domElement.style.top = '0px' document.body.appendChild stats.domElement # Size size = width: window.innerWidth height: window.innerHeight # Renderer renderer = new THREE.WebGLRenderer canvas: canvas antialias: on renderer.setClearColor '#0f0014' renderer.setPixelRatio window.devicePixelRatio renderer.setSize size.width, size.height # Camera camera = new THREE.PerspectiveCamera 45, size.width/size.height, .1, 10000 camera.position.set 0, 0, ctrl.scale # Meshes geometryShere = new THREE.SphereGeometry 800, 28, 14 materialShere = new THREE.MeshBasicMaterial color: '#211200' wireframe: no geometryShere2 = new THREE.WireframeGeometry geometryShere materialShere2 = new THREE.LineBasicMaterial color: 'rgba(255,179,0,1)' transparent: on wireframe = new THREE.LineSegments geometryShere2, materialShere2 meshSphere = new THREE.Mesh geometryShere, materialShere meshSphere.add wireframe meshSphere.position.z = -4000 geometryPlane = new THREE.PlaneGeometry(10000, 10000, 100, 100); materialPlane = new THREE.MeshBasicMaterial color: '#030005' wireframe: no geometryPlane2 = new THREE.WireframeGeometry geometryPlane materialPlane2 = new THREE.LineBasicMaterial color: 'rgba(236,64,122,1)' transparent: on wireframePlane = new THREE.LineSegments geometryPlane2, materialPlane2 meshPlane = new THREE.Mesh geometryPlane, materialPlane meshPlane.add wireframePlane meshPlane.rotation.x = -90 * Math.PI / 180 meshPlane.position.y = -500 meshPlane.position.z = 2000 localPlane = new THREE.Plane new THREE.Vector3( 0, 1, 0 ), 500 renderer.localClippingEnabled = on geometryTerrain = new THREE.PlaneBufferGeometry 10000, 10, 30, 2 materialTerrain = new THREE.MeshBasicMaterial color: '#00050c' wireframe: no clippingPlanes: [ localPlane ] clipShadows: on vertices = geometryTerrain.attributes.position.array for i in [0...vertices.length] by 3 vertices[ i + 1 ] = Math.random() * 1100 geometryTerrain2 = new THREE.WireframeGeometry geometryTerrain materialTerrain2 = new THREE.LineBasicMaterial color: 'rgba(3,155,229,1)' transparent: on clippingPlanes: [ localPlane ] clipShadows: on wireframeTerrain = new THREE.LineSegments geometryTerrain2, materialTerrain2 meshTerrain = new THREE.Mesh geometryTerrain, materialTerrain meshTerrain.add wireframeTerrain meshTerrain.position.y = -1000 meshTerrain.position.z = -3000 # Light light = new THREE.AmbientLight 'white', .5 # Scene scene = new THREE.Scene() scene.add light scene.add meshSphere scene.add meshPlane scene.add meshTerrain # Composer composer = new THREE.EffectComposer renderer # Passes renderPass = new THREE.RenderPass scene, camera composer.addPass renderPass glitchPass = new THREE.GlitchPass 0 composer.addPass glitchPass glitchPass.renderToScreen = on # Render render = -> do stats.begin meshSphere.rotation.x += ctrl.rotationX meshSphere.rotation.y += ctrl.rotationY camera.position.set 0, 0, ctrl.scale do renderer.clear do composer.render do stats.end requestAnimationFrame render do render
Expand for more options Login