Spherical orbiter
How do I make an spherical orbiter?
What is a spherical orbiter? How do you make a spherical orbiter? This script and codes were developed by Josh Beckwith on 24 December 2022, Saturday.
Spherical orbiter - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Spherical orbiter</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src='http://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js'></script>
<script src='https://rawgit.com/dataarts/dat.gui/master/build/dat.gui.min.js'></script>
<script src='https://hammerjs.github.io/dist/hammer.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/three.js/r70/three.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Spherical orbiter - Script Codes CSS Codes
body { margin: 0; overflow: hidden;
}
Spherical orbiter - Script Codes JS Codes
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var World = function () { function World() { var _this = this; _classCallCheck(this, World); this.scene = new THREE.Scene(); this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 10000); // this.camera.position.z = 100 this.renderer = new THREE.WebGLRenderer(); this.renderer.setClearColor(0x000000); document.body.appendChild(this.renderer.domElement); this.resize(); this.addCube(); this.addLight(); var gui = new dat.GUI(); var rotFolder = gui.addFolder('orbital rotation'); rotFolder.add(this.orbital.rotation, 'x', 0, Math.PI * 2); rotFolder.add(this.orbital.rotation, 'y', 0, Math.PI * 2); rotFolder.add(this.orbital.rotation, 'z', 0, Math.PI * 2); var posFolder = gui.addFolder('orbital position'); posFolder.add(this.orbital.position, 'x', -300, 300); posFolder.add(this.orbital.position, 'y', -300, 300); posFolder.add(this.orbital.position, 'z', -300, 300); requestAnimationFrame(this.render.bind(this)); window.addEventListener('resize', this.resize.bind(this)); var mc = new Hammer.Manager(document.body, { recognizers: [[Hammer.Pan, { direction: Hammer.DIRECTION_ALL }]] }); mc.on('pan', function (e) { console.log(e); //TODO: react to orientation _this.orbital.rotation.y -= e.deltaX / 10000; _this.orbital.rotation.x -= e.deltaY / 10000; }); } World.prototype.update = function update() { // this.cube.rotation.y += 0.01 // apply inverse rotation values to cube this.cube.rotation.set(-this.orbital.rotation.x, -this.orbital.rotation.y, -this.orbital.rotation.z); this.orbital.updateMatrixWorld(); var vector = new THREE.Vector3(); vector.setFromMatrixPosition(this.cube.matrixWorld); this.camera.lookAt(vector); }; World.prototype.addLight = function addLight() { var light1 = new THREE.PointLight(0xffffff, 1, 200); light1.position.set(0, 40, -140); this.orbital.add(light1); var light2 = new THREE.AmbientLight(0x404040); this.orbital.add(light2); }; World.prototype.addCube = function addCube() { var geometry = new THREE.BoxGeometry(50, 50, 50); var material = new THREE.MeshLambertMaterial({ color: 0x00ff00 }); this.cube = new THREE.Mesh(geometry, material); this.cube.position.z = -200; this.orbital = new THREE.Object3D(); this.orbital.add(this.cube); this.scene.add(this.orbital); }; World.prototype.render = function render() { this.update(); requestAnimationFrame(this.render.bind(this)); this.renderer.render(this.scene, this.camera); }; World.prototype.resize = function resize() { this.camera.aspect = window.innerWidth / window.innerHeight; this.camera.updateProjectionMatrix(); this.renderer.setSize(window.innerWidth, window.innerHeight); }; return World;
}();
var _w = new World();
Developer | Josh Beckwith |
Username | positlabs |
Uploaded | December 24, 2022 |
Rating | 3 |
Size | 3,870 Kb |
Views | 6,072 |
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 |
Youtube 360 player sandbox | 2,195 Kb |
Fly Eye CSS | 8,718 Kb |
A Pen by Josh Beckwith | 2,313 Kb |
Youtube iframe player sandbox | 2,171 Kb |
Emoji Split with spliddit | 2,156 Kb |
Emoji Split | 3,063 Kb |
Joystick Spinner | 1,788 Kb |
JPG SMASH | 575,800 Kb |
Three orbiter | 3,490 Kb |
Time Dilation | 3,166 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 |
Intake Form Page 2 | Ijantje | 4,983 Kb |
HTML5 Breakout | Jaysalvat | 4,873 Kb |
Bootstrap 4 Gridsystem Demo | Rivella50 | 1,535 Kb |
Project Euler Problem 17 | Bfillmer | 2,739 Kb |
SnappySnippet Test | Elmsoftware | 8,385 Kb |
Email Marketing Mock | Kristenzirkler | 8,224 Kb |
Form Labels | Bartuc | 2,717 Kb |
Google Fonts Sass Mixin | HugoGiraudel | 4,237 Kb |
Codero Sitemap | S1m0ne | 28,169 Kb |
Flickering Light Text Effect | Mandymichael | 3,315 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!