Three orbiter
How do I make an three orbiter?
What is a three orbiter? How do you make a three orbiter? This script and codes were developed by Josh Beckwith on 29 August 2022, Monday.
Three orbiter - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>three 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='http://cdnjs.cloudflare.com/ajax/libs/three.js/r70/three.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Three orbiter - Script Codes CSS Codes
body { margin: 0; overflow: hidden;
}
Three 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 Orbiter = function () { function Orbiter(target, options) { _classCallCheck(this, Orbiter); this.target = target; options = options || {}; this.radius = options.radius || 100; this.s = options.s || 0; this.t = options.t || 0; } Orbiter.prototype.update = function update(deltaTime) { var x = this.radius * Math.cos(this.s) * Math.sin(this.t); var y = this.radius * Math.sin(this.s) * Math.sin(this.t); var z = this.radius * Math.cos(this.t); this.target.position.set(x, y, z); this.target.lookAt(new THREE.Vector3()); }; return Orbiter;
}();
var World = function () { function World() { _classCallCheck(this, World); this.scene = new THREE.Scene(); this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); this.camera.position.z = 100; this.renderer = new THREE.WebGLRenderer(); this.renderer.setClearColor(0x000000); document.body.appendChild(this.renderer.domElement); this.orbiter = new Orbiter(this.camera); this.addCube(); this.addLight(); this.gui = new dat.GUI(); this.gui.add(this.orbiter, 'radius', 10, 1000); this.gui.add(this.orbiter, 's', 0, Math.PI * 2); this.gui.add(this.orbiter, 't', 0, Math.PI * 2); requestAnimationFrame(this.render.bind(this)); window.addEventListener('resize', this.resize.bind(this)); this.resize(); } World.prototype.update = function update() { this.cube.rotation.y += 0.001; this.orbiter.update(); }; World.prototype.addLight = function addLight() { var light1 = new THREE.PointLight(0xffffff, 1, 100); light1.position.set(0, 0, 100); this.scene.add(light1); var light2 = new THREE.AmbientLight(0x404040); this.scene.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.scene.add(this.cube); }; 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 | August 29, 2022 |
Rating | 3 |
Size | 3,490 Kb |
Views | 22,264 |
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 |
Joystick Spinner | 1,788 Kb |
Fly Eye CSS | 8,718 Kb |
A Pen by Josh Beckwith | 2,313 Kb |
Time Dilation | 3,166 Kb |
Punch Button | 3,958 Kb |
Hootsuite Button Demo | 1,457 Kb |
Emoji Split | 3,063 Kb |
Spherical orbiter | 3,870 Kb |
Blurry text | 1,754 Kb |
Refraction image reveal | 3,014 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 |
Haml Calendar | Katydecorah | 5,643 Kb |
Chuck Norris Background | Manz | 1,967 Kb |
Lightning | Akm2 | 19,150 Kb |
Carousel Test | Sbirchall | 1,509 Kb |
3d css cube | Semenchenko | 4,578 Kb |
SVG Modified with Query String | Jnowland | 1,663 Kb |
Multi column experiment. | Spylefkaditis | 2,805 Kb |
CSS Grid Overlay | Cliffpyles | 3,090 Kb |
Funny menu | AxeLVaisper | 4,671 Kb |
A Pen by Alexandru Pora | Axpro | 1,615 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!