<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ThreeJS Fun</title>
    <style>
        body{
            background:#000;
            padding:0px;
            margin:0px;
        }
    </style>
</head>
<body>
    <script type="module">
        import * as THREE from 'https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.module.js';
        import {GLTFLoader} from 'https://threejsfundamentals.org/threejs/resources/threejs/r132/examples/jsm/loaders/GLTFLoader.js';

        const scene = new THREE.Scene();
        const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
        const renderer = new THREE.WebGLRenderer();
        const loader = new GLTFLoader();

        const light = new THREE.SpotLight()
        light.position.set(-20, 15, 120)
        scene.add(light)


        const flamingo = await loader.loadAsync('https://cdn.devdojo.com/assets/3d/parrot.glb');
        scene.add(flamingo.scene);

        scene.background = new THREE.Color('#72c0ff');


        renderer.setSize( window.innerWidth, window.innerHeight );
        camera.position.set( 10, 0, 140 );
        document.body.appendChild( renderer.domElement );

        function animate() {
            requestAnimationFrame( animate );
            renderer.render( scene, camera );
        }
        animate();

        setInterval(function(){
            flamingo.scene.children[0].rotation.y += 0.001;
        }, 5);

    </script>
</body>
</html>

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.