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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <div id="cloud-overlay"></div>

              
            
!

CSS

              
                /* follow me @sam_saccone */


/* insired by 
http://dribbble.com/shots/1046290-The-Powers-Project-10-6
*/






























html {
  background: #422039;
}
*{
 padding: 0px;
 margin: 0px;
}
#stars {
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: -1;
  opacity: 0.24;
}

#cloud-overlay {
  background: url("http://www.lapdawg.com/images/common/clouds.png") no-repeat;
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
  z-index: 2;
  opacity: 0.1;
  background-size: cover;
}
              
            
!

JS

              
                camera = mesh = scene = renderer = fillLight = undefined

drawStars = () ->
  canvas = document.createElement 'canvas'
  canvas.setAttribute 'width', window.innerWidth
  canvas.setAttribute 'height', window.innerHeight
  canvas.setAttribute 'id', "stars"
  ctx = canvas.getContext '2d'
  ctx.fillStyle = "#ffffff"
  for i in [0 .. 200]
    ctx.beginPath();
    sizeRandom = Math.random() * 2
    ctx.arc Math.random() * window.innerWidth, Math.random() * window.innerHeight, sizeRandom, 0, 2*Math.PI, 0
    ctx.fill()

  document.body.appendChild canvas
  
window.onload = () ->
  drawStars()
  camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000)
  camera.position.z = 1000

  scene           = new THREE.Scene
  geometryBase    = new THREE.SphereGeometry(400, 50, 56)
  terranGeom      = new THREE.SphereGeometry(398, 30, 30)
  terranHighGeom  = new THREE.SphereGeometry(390, 20, 20)

  baseMat      = new THREE.MeshLambertMaterial
                    color: 0x76acda
                    shading: THREE.FlatShading

  material     = new THREE.MeshLambertMaterial
                    color: 0xb8b658
                    shading: THREE.FlatShading

  highTerranMat= new THREE.MeshLambertMaterial
                    color: 0xe3c97f
                    shading: THREE.FlatShading

  geometryBase.vertices.forEach (v) ->
    v[["x","y","z"][~~(Math.random() * 3)]] += Math.random() * 10

  [terranHighGeom.vertices, terranGeom.vertices].forEach (g) ->
    g.forEach (v) ->
      v[["x","y","z"][~~(Math.random() * 3)]] += Math.random() * 40

  base = new THREE.Mesh geometryBase, baseMat
  terran = new THREE.Mesh terranGeom, material
  highTerran = new THREE.Mesh terranHighGeom, highTerranMat

  scene.add base
  base.add terran
  base.add highTerran

  light = new THREE.DirectionalLight( 0xffffff )
  light.position.set( 1, 1, 1 )
  scene.add( light )

  fillLight = new THREE.AmbientLight( 0x2e1527 )
  scene.add( fillLight )

  try
    renderer = new THREE.WebGLRenderer()
  catch e
    renderer = new THREE.CanvasRenderer()
    alert "come back in chrome or firefox! or enable webgl"
  
  renderer.setSize window.innerWidth, window.innerHeight


  document.body.appendChild renderer.domElement


  animate = () ->
      base.rotation.y += 0.00125

      requestAnimationFrame animate
      renderer.render scene, camera


  animate()

              
            
!
999px

Console