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

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

              
                <canvas id="canvas"></canvas>
<svg id="logo"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"
 width="423px" height="506px">
<path fill-rule="evenodd"  fill="rgb(237, 160, 58)"
 d="M206.0,506.0 C207.999,506.0 210.0,506.0 212.0,506.0 C224.731,483.638 252.920,443.559 247.0,408.999 C243.666,393.334 240.333,377.665 237.0,362.0 C249.90,360.764 265.944,355.817 275.0,356.0 C285.490,412.869 314.420,430.411 348.999,444.999 C364.453,451.519 381.476,469.757 399.0,473.0 C399.666,472.333 400.333,471.666 401.0,471.0 C411.331,443.435 383.321,382.760 357.0,363.999 C348.550,357.977 319.177,343.695 309.999,339.999 C349.369,314.74 355.644,205.258 317.0,179.999 C275.203,201.49 229.802,169.983 216.0,151.999 C204.667,153.666 193.332,155.333 181.999,157.0 C166.211,197.885 128.211,217.204 96.0,217.999 C96.635,248.209 113.917,256.975 116.999,261.999 C117.746,269.744 139.273,337.483 189.999,353.0 C179.972,371.607 167.181,458.279 206.0,506.0 ZM94.0,197.0 C118.486,208.757 189.879,154.996 154.999,129.0 C122.44,104.437 30.584,166.559 94.0,197.0 ZM286.0,169.0 C310.603,169.155 329.293,149.768 317.0,125.0 C309.75,109.33 291.677,105.116 270.999,100.999 C258.798,98.571 242.861,98.672 233.999,104.999 C229.546,108.180 226.112,115.546 225.999,123.0 C225.494,156.337 276.761,168.135 286.0,169.0 Z"/>
<path fill-rule="evenodd"  fill="rgb(138, 179, 57)"
 d="M148.999,411.999 C151.621,405.642 151.290,383.146 154.999,365.999 C119.113,353.120 92.857,284.770 92.0,276.0 C82.920,268.187 75.366,258.582 70.999,246.0 C66.747,233.747 68.618,218.190 69.999,205.0 C66.0,200.667 61.999,196.332 58.0,191.999 C46.941,195.902 41.356,204.539 28.0,206.0 C25.666,204.666 21.333,201.333 19.0,200.0 C8.490,163.832 60.372,138.877 66.0,137.999 C72.296,128.167 89.278,116.667 105.999,109.999 C128.734,100.935 153.956,106.16 159.999,109.999 C176.557,106.94 195.335,105.333 213.0,102.999 C227.136,75.931 280.413,76.42 307.999,92.0 C315.737,96.475 320.846,102.109 328.0,109.999 C337.46,111.202 352.1,116.666 364.0,120.0 C378.135,125.548 411.978,136.810 402.0,161.0 C400.0,163.333 401.961,163.969 396.0,168.0 C390.38,172.30 360.769,156.723 337.999,152.999 C337.666,153.999 337.333,155.0 336.999,155.999 C336.666,156.999 336.333,158.0 335.999,159.0 C364.753,181.888 380.828,239.519 368.0,290.999 C363.667,304.332 359.332,317.667 355.0,330.999 C366.765,335.422 369.332,338.300 375.999,341.999 C381.578,335.215 392.0,319.332 398.0,310.0 C411.78,287.700 420.663,248.31 421.999,229.999 C423.336,211.968 420.890,160.791 407.999,135.0 C376.826,52.700 285.501,-23.803 152.999,7.0 C48.695,39.2 -40.158,161.571 19.0,296.999 C37.798,340.34 71.867,373.69 110.999,396.0 C123.665,401.332 140.169,409.270 148.999,411.999 Z"/>
</svg>
              
            
!

CSS

              
                body {
  margin: 0;
}
svg {
  display: none;
}
              
            
!

JS

              
                const renderer = new THREE.WebGLRenderer({
  canvas: document.querySelector("#canvas")
});
const loader = new THREE.SVGLoader();

renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;

const scene = new THREE.Scene();
scene.background = new THREE.Color( 0xffffff );
const camera = new THREE.PerspectiveCamera(
  100,
  window.innerWidth / window.innerHeight
, 1, 1000);
camera.position.set(0, 500, 430);


const light = new THREE.DirectionalLight(0xffffff, 0.3);
scene.add(light);
const spotlight = new THREE.SpotLight( 0xffffff, 0.8 );
spotlight.position.set( 500, 200, 400 );
scene.add( spotlight );

const svgMarkup = document.querySelector("#logo").outerHTML;
const svgData = loader.parse(svgMarkup);

const svgGroup = new THREE.Group();
const shadowGroup = new THREE.Group();
svgData.paths.forEach((path, i) => {
  const shapes = path.toShapes(true);

  shapes.forEach((shape, j) => {
    const material = new THREE.MeshToonMaterial({
      color: path.color,
      side: THREE.DoubleSide,
      depthWrite: false
    });
    const geometry = new THREE.ExtrudeGeometry(shape, {
      depth: 50,
      bevelEnabled: false,
    });
    const material2 = new THREE.MeshToonMaterial({
      color: path.color,
      side: THREE.DoubleSide,
      depthWrite: false,
      transparent:true,
      opacity: 0.3,
    });
    const geometry2 = new THREE.ExtrudeGeometry(shape, {
      depth: 10,
      bevelEnabled: false
    });
    const mesh = new THREE.Mesh(geometry, material);
    const mesh2 = new THREE.Mesh(geometry2, material2);
    mesh.castShadow = true;
    svgGroup.add(mesh);
    shadowGroup.add(mesh2);
  });
});

const box = new THREE.Box3().setFromObject(svgGroup);
const size = new THREE.Vector3();
box.getSize(size);

const yOffset = size.y / -2;
const xOffset = size.x / -2;

svgGroup.position.x = xOffset;
svgGroup.position.y = yOffset;
shadowGroup.position.x = xOffset;
svgGroup.rotation.y = 0.02;
shadowGroup.rotation.y = 0.02;
shadowGroup.rotation.x = -4.8;
shadowGroup.position.y = -50 + yOffset;
shadowGroup.position.z = 15;

scene.add(svgGroup);
scene.add(shadowGroup);

document.addEventListener( 'mousemove', onDocumentMouseMove );
window.addEventListener( 'resize', onWindowResize );

let mouseX = 0;
let mouseY = 0;
let windowHalfX = window.innerWidth / 2;
let windowHalfY = window.innerHeight / 2;

tick();
function tick() {
  // svgGroup.rotation.y +=0.01;
  renderer.render(scene, camera);
  render();
  requestAnimationFrame(tick);
}

function onDocumentMouseMove( event ) {
  mouseX = ( event.clientX - windowHalfX );
  mouseY = ( event.clientY - windowHalfY );
}

function onWindowResize() {
  windowHalfX = window.innerWidth / 2;
  windowHalfY = window.innerHeight / 2;

  camera.aspect = window.innerWidth / window.innerHeight;
  camera.updateProjectionMatrix();

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

function render() {
  camera.position.x += ( mouseX - camera.position.x ) * 0.05;
  camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
  camera.lookAt( scene.position );

  renderer.render( scene, camera );
}
              
            
!
999px

Console