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 - Texture Render | 2,402 Kb |
Cube Sides | 2,390 Kb |
Initial Scene | 2,545 Kb |
Smoke Shader - Diffuse | 3,283 Kb |
Pixijs.v3 Rendering Texture | 2,632 Kb |
Pixijs.v3 Sending Data to Shader | 2,599 Kb |
Pixijs.v3 Shader Example | 3,213 Kb |
Smoke Shader - Setup | 2,339 Kb |
Smoke Shader Algorithm Demo | 14,358 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 |
CSS Gem Badge | Orchard | 3,335 Kb |
Android Play Store With Slick Carousel | -J0hn- | 4,982 Kb |
React Template | Isac | 1,241 Kb |
Contact | GanNichiHa | 2,514 Kb |
Clock with full screen background | Owebboy | 2,415 Kb |
Social buttons | Flacu | 2,022 Kb |
Wip elementary os navbar | Nickcolley | 2,993 Kb |
CSS3 Animated buttons | Cguillou | 3,737 Kb |
Sticky footer testing | 75th | 1,649 Kb |
BlueBox Fork | Huskynation | 12,675 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!