Cube Sides
How do I make an cube sides?
A simple set up to follow along with the Tutsplus guide on graphics shaders. What is a cube sides? How do you make a cube sides? This script and codes were developed by Omar Shehata on 13 August 2022, Saturday.
Cube Sides - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Cube Sides</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src='https://cdnjs.cloudflare.com/ajax/libs/three.js/r71/three.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Cube Sides - Script Codes CSS Codes
/* We want our scene to span the entire window */
body { margin: 0; }
Cube Sides - Script Codes JS Codes
//@author Omar Shehata. 2015. //We are loading the Three.js library from the cdn here: http://cdnjs.com/libraries/three.js/ var scene; var camera; var renderer; function scene_setup(){ //This is all code needed to set up a basic ThreeJS scene //First we initialize the scene and our camera scene = new THREE.Scene(); camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); //We create the WebGL renderer and add it to the document renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); document.body.appendChild( renderer.domElement ); } scene_setup(); //Add your code here! var geometry = new THREE.BoxGeometry( 1, 1, 1 ); var material = new THREE.MeshBasicMaterial( { color: 0x00ff00} );//We make it green var cube = new THREE.Mesh( geometry, material ); //Add it to the screen scene.add( cube ); cube.position.z = -3;//Shift the cube back so we can see it //Load an image THREE.ImageUtils.crossOrigin = '';//Allows us to load an external image
var tex = THREE.ImageUtils.loadTexture( "http://i.imgur.com/reFDdfi.png" ); //Create an object with a texture on each side var material = new THREE.MeshBasicMaterial({map: tex}) var geometry = new THREE.BoxGeometry( 1, 1, 1 ); var sprite = new THREE.Mesh( geometry,material ); scene.add( sprite ); sprite.position.z = -2;//Move it back so we can see it //Render everything! function render() { sprite.rotation.y += 0.02; sprite.rotation.x += 0.02; requestAnimationFrame( render ); renderer.render( scene, camera ); } render();
Developer | Omar Shehata |
Username | omarshe7ta |
Uploaded | August 13, 2022 |
Rating | 3 |
Size | 2,390 Kb |
Views | 42,504 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Framebuffer - Final | 2,491 Kb |
ACM Drawing Practice | 1,802 Kb |
Smoke Shader Algorithm Demo | 14,358 Kb |
Rotating Cube | 2,151 Kb |
Framebuffer - Basic Scene | 2,217 Kb |
Featherlight Zoom Test | 1,695 Kb |
Smoke Shader - Setup | 2,339 Kb |
WebMonkey Test | 8,206 Kb |
Buggy Smoke | 3,213 Kb |
Smoke Shader - Frame Buffer | 2,672 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Flat UI - Checkbox FIX | ARS | 2,663 Kb |
CSS-Flexbox-Demo | Sstiglets | 1,709 Kb |
Slider | Mohammed-fawzy | 2,634 Kb |
CSSOff 2013 Submission | Codewunder | 14,766 Kb |
Importable Clearfix | Corysimmons | 1,411 Kb |
404 Page | Saransh | 2,666 Kb |
Google Fonts Sass Mixin | HugoGiraudel | 4,237 Kb |
Scroll to view if element partially out of view port height | ChrisMaki | 2,104 Kb |
Twinner Spinner II | Katydecorah | 2,974 Kb |
Base-Style | Daniel_gooss | 2,614 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!