Skip to main content

examples/webgl_animation_keyframes.html

 <!DOCTYPE html>

<html lang="en">

<head>

<title>three.js webgl - animation - keyframes</title>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

<link type="text/css" rel="stylesheet" href="main.css">

<style>

body {

background-color: #bfe3dd;

color: #000;

}


a {

color: #2983ff;

}

</style>

</head>


<body>


<div id="container"></div>


<div id="info">

<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - animation - keyframes<br/>

Model: <a href="https://artstation.com/artwork/1AGwX" target="_blank" rel="noopener">Littlest Tokyo</a> by

<a href="https://artstation.com/glenatron" target="_blank" rel="noopener">Glen Fox</a>, CC Attribution.

</div>


<script type="importmap">

{

"imports": {

"three": "../build/three.module.js",

"three/addons/": "./jsm/"

}

}

</script>


<script type="module">


import * as THREE from 'three';


import Stats from 'three/addons/libs/stats.module.js';


import { OrbitControls } from 'three/addons/controls/OrbitControls.js';

import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';


import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';


let mixer;


const clock = new THREE.Clock();

const container = document.getElementById( 'container' );


const stats = new Stats();

container.appendChild( stats.dom );


const renderer = new THREE.WebGLRenderer( { antialias: true } );

renderer.setPixelRatio( window.devicePixelRatio );

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

container.appendChild( renderer.domElement );


const pmremGenerator = new THREE.PMREMGenerator( renderer );


const scene = new THREE.Scene();

scene.background = new THREE.Color( 0xbfe3dd );

scene.environment = pmremGenerator.fromScene( new RoomEnvironment( renderer ), 0.04 ).texture;


const camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 100 );

camera.position.set( 5, 2, 8 );


const controls = new OrbitControls( camera, renderer.domElement );

controls.target.set( 0, 0.5, 0 );

controls.update();

controls.enablePan = false;

controls.enableDamping = true;


const dracoLoader = new DRACOLoader();

dracoLoader.setDecoderPath( 'jsm/libs/draco/gltf/' );


const loader = new GLTFLoader();

loader.setDRACOLoader( dracoLoader );

loader.load( 'models/gltf/LittlestTokyo.glb', function ( gltf ) {


const model = gltf.scene;

model.position.set( 1, 1, 0 );

model.scale.set( 0.01, 0.01, 0.01 );

scene.add( model );


mixer = new THREE.AnimationMixer( model );

mixer.clipAction( gltf.animations[ 0 ] ).play();


animate();


}, undefined, function ( e ) {


console.error( e );


} );



window.onresize = function () {


camera.aspect = window.innerWidth / window.innerHeight;

camera.updateProjectionMatrix();


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


};



function animate() {


requestAnimationFrame( animate );


const delta = clock.getDelta();


mixer.update( delta );


controls.update();


stats.update();


renderer.render( scene, camera );


}



</script>


</body>


</html>

Comments

Popular posts from this blog

New video by T-Series on YouTube

THE PUNJAABBAN SONG (Teaser) JugJugg Jeeyo | Varun Kiara Anil Neetu | Gippy Zahrah Tanishk Romy Presenting teaser of the song #ThePunjaabbanSong from movie #JugJuggJeeyo starring Varun Dhawan, Kiara Advani, Anil Kapoor, Neetu Kapoor, Maniesh Paul & Prajakta Koli. Viacom18 Studios & Dharma Productions present A Dharma Productions Film JUGJUGG JEEYO Starring Varun Dhawan, Kiara Advani, Anil Kapoor, Neetu Kapoor, Maniesh Paul & Prajakta Koli Directed by Raj Mehta Produced by Hiroo Yash Johar, Karan Johar, Apoorva Mehta Story by Anurag Singh Screenplay and Dialogues by Rishhabh Sharrma Screenplay by Anurag Singh & Sumit Bhateja In cinemas 24th June, 2022. Song CREDITS Song Name: THE PUNJAABBAN SONG Singers: Gippy Grewal, Zahrah S Khan, Tanishk Bagchi & Romy Music - Tanishk Bagchi Programmed and Arranged - Tanishk Bagchi Lyrics - Tanishk Bagchi Music Label: T-Series Original Song Credits Nach Punjaban By Abrar Ul Haq from the album Nach Punjaban Courtesy of Moviebox (Bi...

85 साल की शांताबाई पवार का कमाल देख हर कोई हैरान, 'लाठी-काठी' का करतीं हैं शानदार प्रदर्शन

पुणे में इन दिनों एक 85 साल की बुजुर्ग महिला खूब चर्चा में हैं। ये सड़कों पर 'लाठी-काठी' का प्रदर्शन करती हैं। बुजुर्ग महिला का ये कमाल देखकर हर कोई हैरान है। आप भी देखिए। from Latest And Breaking Hindi News Headlines, News In Hindi | अमर उजाला हिंदी न्यूज़ | - Amar Ujala https://ift.tt/3jAPGwr via IFTTT

New video by T-Series on YouTube

Aila Re Aillaa - Sooryavanshi |Akshay Kumar, Ajay Devgn, Ranveer Singh| Check Description| #YTShorts Check out full video here: https://youtu.be/CDmPmzi8eYc Presenting the first song "Aila Re Aillaa " from the most awaited movie of the year "Sooryavanshi". The movie is starring Akshay Kumar, Ajay Devgn, Ranveer Singh, and Katrina Kaif in the lead role. ♪Stream the Full Song Here♪ JioSaavn: https://bit.ly/AilaReAillaa-Sooryavanshi-JioSaavn Spotify: https://bit.ly/AilaReAillaa-Sooryavanshi-Spotify Hungama: https://bit.ly/AilaReAillaa-Sooryavanshi-Hungama Gaana: https://bit.ly/AilaReAillaa-Sooryavanshi-Gaana Apple Music: https://bit.ly/AilaReAillaa-Sooryavanshi-AppleMusic Amazon Prime Music: https://bit.ly/AilaReAillaa-Sooryavanshi-AmazonPrimeMusic Wynk: https://bit.ly/AilaReAillaa-Sooryavanshi-Wynk Resso: https://bit.ly/AilaReAillaa-Sooryavanshi-Resso iTunes: https://bit.ly/AilaReAillaa-Sooryavanshi-iTunes YouTube Music: https://bit.ly/AilaReAillaa-Sooryavanshi-YouTu...