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

              
                <canvas id="scene"></canvas>
<!-- feather from freepik.com -->
<!-- Reduce the amount of feathers in the Js if it lags in your browser -->
              
            
!

CSS

              
                body,html, canvas{width:100%;height:100%;overflow: hidden;}
		canvas{
			position: absolute;
			top:0;
			left:0;
		}
              
            
!

JS

              
                var renderer, scene, camera, feathers,
  ww = window.innerWidth,
  wh = window.innerHeight
amount = 400;

var featherTexture,
  mouse = {
    x: -0.007
  };

var center = new THREE.Vector3(0, 100, 0);

function init() {
  var canvas = document.getElementById("scene");
  renderer = new THREE.WebGLRenderer({
    canvas: canvas
  });
  renderer.setSize(ww, wh);
  renderer.setClearColor(0xF5CC70);

  scene = new THREE.Scene();
  scene.fog = new THREE.Fog(0xF5CC70, 500, 850);

  feathers = new THREE.Object3D()
  for (var i = 0; i < amount; i++) {
    feathers.add(new Feather(i));
  }

  scene.add(feathers);

  camera = new THREE.PerspectiveCamera(50, ww / wh, 1, 10000);
  camera.position.set(0, 0, 500);
  camera.lookAt(center);
  scene.add(camera);

  var light = new THREE.HemisphereLight(0xF5CC70, 0xF2676B, 1.5);
  scene.add(light);

  window.addEventListener("resize", onWindowResize);
  window.addEventListener("mousemove", onMouseMove);

  requestAnimationFrame(render);
}

function onWindowResize() {

  ww = window.innerWidth;
  wh = window.innerHeight;

  renderer.setSize(ww, wh);
  camera.aspect = ww / wh;
  camera.updateProjectionMatrix();
}

function onMouseMove(e) {
  mouse.x = (e.clientX - ww / 2) / (ww / 2) / 40;
};

function Feather(i) {

  var size = Math.random() * 50 + 10;
  var geometry = new THREE.PlaneGeometry(size, size, 3);
  var material = new THREE.MeshLambertMaterial({
    side: THREE.DoubleSide,
    map: featherTexture,
    transparent: true,
    color: new THREE.Color("hsl(" + (120 * (i / amount)) + ", 50%, 80%)"),
    alphaTest: 0.8
  });
  var feather = new THREE.Mesh(geometry, material);
  feather.opts = {};

  feather.opts.position = {
    x: (Math.random() - 0.5) * 600,
    y: (Math.random() * 200),
    z: (Math.random() - 0.5) * 600
  }

  feather.opts.rotation = {
    x: Math.random() * (Math.PI * 2),
    y: Math.random() * (Math.PI * 2),
    z: Math.random() * (Math.PI * 2)
  }

  feather.opts.speed = {
    x: (Math.random() - 0.5),
    y: -Math.random(),
    z: (Math.random() - 0.5),
    rx: (Math.random() - 0.5) / 50,
    ry: (Math.random() - 0.5) / 50,
    rz: (Math.random() - 0.5) / 50
  }

  feather.position.set(feather.opts.position.x, feather.opts.position.y, feather.opts.position.z);
  feather.rotation.set(feather.opts.rotation.x, feather.opts.rotation.y, feather.opts.rotation.z);

  return feather;
};

var position = 0;
var render = function(a) {
  requestAnimationFrame(render);

  for (var i = 0; i < amount; i++) {
    var feather = feathers.children[i];
    feather.position.x += feather.opts.speed.x;
    feather.position.y += feather.opts.speed.y;
    feather.position.z += feather.opts.speed.z;
    feather.rotation.x += feather.opts.speed.rx;
    feather.rotation.y += feather.opts.speed.ry;
    feather.rotation.z += feather.opts.speed.rz;

    if (feather.position.y <= -250) {
      feather.position.x = (Math.random() - 0.5) * 50;
      feather.position.y = (Math.random() - 0.5) * 20 + 300;
      feather.position.z = (Math.random() - 0.5) * 50;
    }
  }

  position += mouse.x;
  camera.position.x = Math.sin(position) * 800;
  camera.position.z = Math.cos(position) * 800;
  camera.lookAt(center);

  renderer.render(scene, camera);
};

var image = new Image();
var textureLoader = new THREE.TextureLoader();
image.onload = function() {
  textureLoader.load(image.src, function(t) {
    featherTexture = t;
    init();
  });
};
image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAC61BMVEUAAACHTYx3LmeLRJa0rtdwKVRwKVRwKVSzq9VwKVRwKVRwKVRwKVRwKVSQN46QN460rtdwKVS0rtdwKVS0rtdwKVS0rtdyKld/PpO0rtd1Q5Z2Q5aQN45wKVRwKVR1Q5a0rtdwKVS0rtdwKVRwKVRwKVSIOpFwKVRwKVRwKVVwKVS0rtd6SJlwKVRwKVR1Q5Z1Q5ZxKVa0rteQN46QN452QpZwKVSQN460rteUYKZwKVW0rteQN45wKVSocrCocrCncbCvlcd1Q5aQN460rtdxKVW0rte0rtdwKVSRXaR1Q5ZwKVS0rtd1Q5ZxKVa0rte0rtd1Q5aQN460rte0rNZ1Q5Z+P5OQN46wmsp5LGN1Q5aocrCPNo20rte0rtd1Q5a0rtdwKVRwKVSocrCQN45wKVRyKVe0rtdwKVSQN460rtdwKVSwmcqQN46ocrCQN451Q5Z1Q5ZwKVSQN451Q5a0rNaQN451Q5aocrCncbC0rtd1Q5a0rteQN460rteQN451Q5aQN45wKVRwKVSqfLeQN46ocrCQN45wKVR1Q5Z2QpaPN46ocrB2QpaPN46QN460rtdwKVR1Q5ancbB1Q5ZwKVS0rteocrCocrC0rteQN460rtd3QpWQN451Q5ZwKVSmcK+0rteQN45wKVSSXqSocrB1Q5aQN46WYadyKleQN46QN46HM32rgLqEMnmsg7x1Q5Z9LmuocrCZZKiaZamocrCLNISVYKZ9QJR6LWWCMXStiL+ocrCujMJ+LmuocrCtjMGsh76ocrCocrCocrCaZal6LWZ5LWOLOY+AMHCocrCdaKp1Q5a0rteocrCQN45wKVSmcK+jba2IVaB9P5R4Q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