3D Tools

Size
2,502 Kb
Views
12,144

How do I make an 3d tools?

What is a 3d tools? How do you make a 3d tools? This script and codes were developed by Sarah Cartwright on 05 December 2022, Monday.

3D Tools Previews

3D Tools - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>3D Tools</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> This Pen does nothing on its own - it is used in other pens. <script src="js/index.js"></script>
</body>
</html>

3D Tools - Script Codes CSS Codes

body { padding: 10px; margin: 0px; background: #2e2e2e; color: #909090; font: 12px arial, sans-serif;
}

3D Tools - Script Codes JS Codes

var trig = new _trigCached();
function _trigCached(){ this.sine = [], this.cosine = []; //Create cached sin/cos values for(var a = 0; a < 36000; a++){ this.sine.push(Math.sin((a/100)/180*Math.PI)); this.cosine.push(Math.cos((a/100)/180*Math.PI)); }
}
//Square shaped explosions.
function newVector(shape){ // Something's wrong with my LFSR, using slow version of rand.... var vx = randomRealRangeSlow(shape.xMin, shape.xMax), vy = randomRealRangeSlow(shape.yMin, shape.yMax), vz = randomRealRangeSlow(shape.zMin, shape.zMax); var p = randomRealRangeSlow(shape.minPower, shape.maxPower); return {x: vx*p, y: vy*p, z: vz*p};
}
//A more rounded bang.
function newRoundVector(shape){ // Something's wrong with my LFSR, using slow version of rand.... var pitch = randomIntRangeSlow(0, 36000), yaw = randomIntRangeSlow(0, 36000); var vx = trig.sine[pitch] * trig.cosine[yaw], vy = trig.sine[pitch] * trig.sine[yaw], vz = trig.cosine[pitch]; /* var pitch = randomRealRangeSlow(0, 360) / 180 * Math.PI, yaw = randomRealRangeSlow(0, 360) / 180 * Math.PI; var vx = Math.sin(pitch) * Math.cos(yaw), vy = Math.sin(pitch) * Math.sin(yaw), vz = Math.cos(pitch); */ var p = randomRealRangeSlow(shape.minPower, shape.maxPower); return {x: vx*p, y: vy*p, z: vz*p};
}
function _3DPoint(){ this.x = 0; this.y = 0; this.z = 0; this.x2 = 0; this.y2 = 0; this.z2 = 0; this.xx = 0; this.yy = 0; this.zz = 0; this.xv = 0; this.yv = 0; this.zv = 0; this.screenX = 0; this.screenY = 0; this.scale = 0;
}
_3DPoint.prototype.updatePosition = function(){ this.x += this.xv; this.y += this.yv; this.z += this.zv;
}
_3DPoint.prototype.rotate = function(rotX, rotY, rotZ){ this.xx = this.x * trig.cosine[rotX] - this.y * trig.sine[rotX]; this.yy = this.x * trig.sine[rotX] + this.y * trig.cosine[rotX]; this.y2 = this.yy * trig.cosine[rotY] - this.z * trig.sine[rotY]; this.zz = this.yy * trig.sine[rotY] + this.z * trig.cosine[rotY]; this.x2 = this.xx * trig.cosine[rotZ] - this.zz * trig.sine[rotZ]; this.z2 = this.xx * trig.sine[rotZ] + this.zz * trig.cosine[rotZ];
}
_3DPoint.prototype.calculateScreenPosition = function(rotX, rotY, rotZ, cameraX, cameraY, cameraZ, perspective){ this.rotate(rotX, rotY, rotZ); this.x2 += cameraX; this.y2 += cameraY; this.z2 += cameraZ; this.scale = 350 / (this.z2 * perspective); this.screenX = (this.x2 * 400) * this.scale; this.screenY = (this.y2 * 400) * this.scale;
}
function dynamicSort(property) { var sortOrder = 1; if(property[0] === "-") { sortOrder = -1; property = property.substr(1); } return function (a,b) { var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0; return result * sortOrder; }
}
function compare(a, b) { if (a.point.z2 < b.point.z2) return 1; if (a.point.z2 > b.point.z2) return -1; return 0;
}
3D Tools - Script Codes
3D Tools - Script Codes
Home Page Home
Developer Sarah Cartwright
Username SarahC
Uploaded December 05, 2022
Rating 3
Size 2,502 Kb
Views 12,144
Do you need developer help for 3D Tools?

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!

Sarah Cartwright (SarahC) Script Codes
Create amazing video scripts with AI!

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!