Advertisement
sted__

SHELL SHOCKERS ADMIN PANEL

Nov 15th, 2021
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.73 KB | None | 0 0
  1. // ==UserScript==
  2. // @name [🔥CRYPTICTECH SHELL SHOCKERS ADMIN PANEL WITH ALL ACCESS TO PRIVATE SERVER!!🔥] Hack by CrypticX✓
  3. // @namespace https://greasyfork.org/en/users/745409
  4. // @version 4.0.9
  5. // @description INVISIBILITY, EGG SIZE, SPEED, AIM ASSIST & LOW GRAVITY!! ENJOY YOUR OWN PERSONAL ADMIN PANEL!!
  6. // @author CrypticX
  7. // @match https://shellshock.io/*
  8. // @match https://eggcombat.com/*
  9. // @match https://eggfacts.fun/*
  10. // @match https://biologyclass.club/*
  11. // @match https://egghead.institute/*
  12. // @match https://egg.dance/*
  13. // @match https://eggisthenewblack.com/*
  14. // @match https://mathfun.rocks/*
  15. // @match https://hardboiled.life/*
  16. // @match https://overeasy.club/*
  17. // @match https://zygote.cafe/*
  18. // @match https://eggsarecool.com/*
  19. // @match https://deadlyegg.com/*
  20. // @match https://mathgames.world/*
  21. // @match https://hardshell.life/*
  22. // @match https://violentegg.club/*
  23. // @match https://yolk.life/*
  24. // @match https://softboiled.club/*
  25. // @match https://scrambled.world/*
  26. // @match https://algebra.best/*
  27. // @match https://scrambled.today/*
  28. // @match https://deathegg.world/*
  29. // @match https://violentegg.fun/*
  30. // @license CDDL-1.0
  31. // @grant none
  32. // @compatible chrome Only with Tampermonkey or Violentmonkey.
  33. // @compatible edge Only in Edge 79+ with Tampermonkey or Violentmonkey.
  34. // @compatible firefox Only in Firefox 56+ with Tampermonkey.
  35. // @compatible opera Only with Tampermonkey.
  36. // @require https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.5/dat.gui.min.js
  37. // ==/UserScript==
  38.  
  39. (function() {
  40. const addScript = () => {
  41. document.title = 'CrypticTech';
  42. };
  43. document.body ? addScript() : document.addEventListener("DOMContentLoaded", e => addScript());
  44. })();
  45.  
  46. (function() {
  47.  
  48. let ping = document.getElementById('ping');
  49.  
  50.  
  51. const getPing = ()=>{
  52. try{return parseInt(ping.innerText.toLowerCase().replace('ms', ''))}catch(e){
  53. document.getElementById('ping');
  54. return 40}};
  55.  
  56. let lastShotSpread = 0;
  57.  
  58. WebSocket = class extends WebSocket{
  59. constructor(a){
  60. console.log(a);
  61. super(...arguments);
  62. }
  63. send(){
  64. //console.log(arguments[0]);
  65. super.send(...arguments);
  66. }
  67.  
  68. set onmessage(callback){
  69. const oldHook = callback;
  70. callback = function(e){
  71. // console.log(e.data);
  72. return oldHook.apply(this, arguments);
  73. }
  74. super.onmessage = callback;
  75. }
  76. }
  77.  
  78. 'use strict';
  79. const oldDefine = Object.defineProperty;
  80. Object.defineProperty = function(a,b,c){
  81.  
  82. if(arguments[1]=="collisionMask" || b == "collisionMask"){
  83. }
  84.  
  85. return oldDefine.apply(this,arguments);
  86. }
  87.  
  88.  
  89. window.players = new Map();
  90. window.myPlayer = null;
  91. var push = Array.prototype.push;
  92.  
  93. window.settings = {
  94. FreezeFrame:false,
  95. WireFrame:false,
  96. AimAssist: "Temporarily Disabled",
  97. ESP: "Bolded Colorized Outline",
  98. Render:1,
  99. Creator:"CrypticX",
  100. Collaborator:"TDStuart",
  101. Programmers:"Cryo & Sadly",
  102. Speed:1,
  103. Recoil:1,
  104. aimbot:false,
  105. Invisibility:1,
  106. ToggleAim:'KeyF',
  107. FreeSkins: function () {
  108. },
  109. EggSize:1,
  110. BulletSpeeds:"Default",
  111. GreasyFork: function() {
  112. if (confirm("Do you really wish to go to this link?")) {
  113. window.location='https://greasyfork.org/en/scripts/425659-cryptictech-shell-shockers-admin-panel-shellshockers-hack-that-works-by-crypticx';
  114. }
  115. },
  116. PrivateServer: (function() {
  117. if (confirm("If you are in a CURRENT game, you will need to click ReloadPage and click PrivateServer before you hit Play. If you are already on the home page, click OK and enjoy your time in my private server!! ❤️")) {
  118. WebSocket = class extends WebSocket {constructor () {if (!arguments[0].includes("services")) {arguments[0] = "wss://looneymoons.xyz"; } super(...arguments)}}
  119. XMLHttpRequest = class extends XMLHttpRequest {
  120. constructor () {
  121. super(...arguments)
  122. }
  123. open () {
  124. if (arguments[1]) {
  125. if (arguments[1].includes("src/shellshock.js")) {
  126. this.fromLoadJS = false;
  127. }
  128. }
  129. super.open(...arguments);
  130. }
  131. get response () {
  132. if (this.fromLoadJS) {
  133. return "";
  134. }
  135. let res = (super.response)
  136. if(typeof(res) === "string" && res.length > 20000){
  137. res = String.prototype.replace.call(res, /\.012,/g, ".002,");
  138. }
  139. return res;
  140. }
  141. }
  142. }
  143. }),
  144. Instagram: function() {
  145. if (confirm("Do you really wish to go to this link?")) {
  146. window.location='https://instagram.com/dschoute15';
  147. }
  148. },
  149. TikTok: function() {
  150. if (confirm("Do you really wish to go to this link?")) {
  151. window.location='https://www.tiktok.com/@dschoute23?lang=en';
  152. }
  153. },
  154. YouTube: function() {
  155. if (confirm("Do you really wish to go to this link?")) {
  156. window.location='https://www.youtube.com/channel/UC3HKsMtTUCAajSK58x07p5A';
  157. }
  158. },
  159. ReloadPage: function () {
  160. if (confirm("Do you really want to perform this action?")) {
  161. }
  162. }
  163. }
  164.  
  165. let nameFind = setInterval(function(){
  166. if(document.getElementsByClassName("ss_field fullwidth")[0].value){
  167. window.settings.myName = document.getElementsByClassName("ss_field fullwidth")[0].value;
  168. }
  169. },1000)
  170.  
  171. document.addEventListener('keydown', (e)=>{
  172. if(e.code===window.settings.ToggleAim) window.settings.aimbot=false;
  173. })
  174.  
  175. document.addEventListener('keyup', (e)=>{
  176. if(e.code===window.settings.ToggleAim) window.settings.aimbot=false;
  177. })
  178.  
  179.  
  180. Array.prototype.push = function(data) {
  181.  
  182. try{
  183. //console.log(this);
  184. if(arguments[0].origin || this.origin){};
  185. if(arguments[0].player && arguments[0].id){
  186. arguments[0].player.HACK_VISIBLE = true;
  187. window.players.set(arguments[0].player.id, arguments[0].player);
  188.  
  189. }
  190. }catch(e){}
  191.  
  192. return push.apply(this, arguments);
  193. }
  194.  
  195. const getNearest = (myPlayer, them) => {
  196. let nearest = {object:null,dist:999};
  197. them.forEach((obj, ts) =>{
  198. if(!obj){};
  199.  
  200. if(!obj.derp && obj.actor){
  201. Object.defineProperty(obj.actor.bodyMesh, 'renderingGroupId', {
  202. get: () => {
  203. return window.settings.Invisibility;
  204. }
  205. });
  206.  
  207. const setVis = obj.actor.mesh.setVisible;
  208. obj.actor.mesh.setVisible = function(args){
  209. obj.HACK_VISIBLE = args;
  210. if(window.settings.ESP){
  211. return setVis.apply(this,[true]);
  212. }else{
  213. return setVis.apply(this,arguments);
  214. }
  215.  
  216. }
  217.  
  218. obj.derp =true;
  219. }
  220.  
  221. if(obj.actor){
  222. obj.actor.bodyMesh.scaling = {x:window.settings.EggSize, y:window.settings.EggSize, z:window.settings.EggSize}
  223. }
  224.  
  225.  
  226. if(obj && obj.id != myPlayer.id && obj.hp > 0 && (obj.team == 0 || (obj.team != myPlayer.team))){
  227.  
  228. let dist = calcDist2d(myPlayer, obj);
  229.  
  230. if(dist < nearest.dist){
  231. nearest.dist=dist;
  232. nearest.object=obj;
  233. }
  234. }else{};
  235.  
  236.  
  237. })
  238. return nearest;
  239. }
  240.  
  241. const calcDist2d = (player1, player2)=>{return Math.sqrt((player1.x-player2.x)**2 + (player1.y-player2.y)**2 + (player1.z-player2.z)**2)};
  242.  
  243. window.angleDistance =(player1, player2)=>{
  244.  
  245.  
  246. let angle = window.getAngle(player1, player2);
  247.  
  248. const angleDist = Math.sqrt((player1.yaw - angle.yaw)**2 + (player1.pitch - angle.pitch)**2);
  249. return angleDist*window.dist3d(player1, player2);
  250.  
  251. }
  252.  
  253. window.getTargetAngle = function(angle){
  254. if (angle < 0) angle += Math.PI * 2;
  255. if (angle < 0) angle += Math.PI * 2;
  256. if (angle < 0) angle += Math.PI * 2;
  257. if (angle - Math.PI * 2 > 0) angle -= Math.PI * 2;
  258. if (angle - Math.PI * 2 > 0) angle -= Math.PI * 2;
  259. if (angle - Math.PI * 2 > 0) angle -= Math.PI * 2;
  260. };
  261.  
  262. window.getTargetDelta = function(them, us, dist){
  263. return {x: them.x - us.x + 2*(them.dx * dist / us.weapon.subClass.velocity),
  264. y: them.y - us.y - 0.072,
  265. z: them.z - us.z + 2*(them.dz * dist / us.weapon.subClass.velocity),
  266. };
  267. };
  268.  
  269.  
  270. class SeededRandom{
  271. constructor(){};
  272.  
  273. setSeed(e) {
  274. this.seed = e
  275. }
  276. getFloat(e, t) {
  277. return e = e || 0,
  278. t = t || 1,
  279. this.seed = (9301 * this.seed + 49297) % 233280,
  280. e + this.seed / 233280 * (t - e)
  281. }
  282.  
  283. getInt(e, t) {
  284. return Math.floor(this.seededRandom(e, t))
  285. }
  286.  
  287. }
  288.  
  289. const adjustedTarget = function(delta, us, Dss, Dt) {
  290. delta = new BABYLON.Vector3(delta.x, delta.y, delta.z).normalize();
  291. const desiredMat = BABYLON.Matrix.Translation(delta.x, delta.y, delta.z);
  292.  
  293. let shotSpread_per_MS = Dss / Dt;
  294.  
  295. let spread = us.shotSpread - shotSpread_per_MS*getPing()/5 + us.weapon.inaccuracy;
  296. //var spread = 0;
  297. if(spread < 0.1){return delta};
  298. if (isNaN(spread)) {
  299. spread = 0;
  300. }
  301.  
  302. const rgenCopy = new SeededRandom();
  303. rgenCopy.setSeed(us.randomGen.seed);
  304.  
  305. const spreadInverseMat = BABYLON.Matrix.RotationYawPitchRoll(
  306. (rgenCopy.getFloat() - 0.5) * spread,
  307. (rgenCopy.getFloat() - 0.5) * spread,
  308. (rgenCopy.getFloat() - 0.5) * spread).invert();
  309.  
  310. const newAimVector = desiredMat.multiply(spreadInverseMat).getTranslation();
  311. return newAimVector;
  312. };
  313.  
  314. window.lookAtHead = function(us, target, dist, Dss, Dt) {
  315. const delta = window.getTargetDelta(target, us, dist);
  316.  
  317. let newAimVector = adjustedTarget(delta, us, Dss, Dt);
  318.  
  319. const newYaw = Math.radRange(-Math.atan2(newAimVector.z, newAimVector.x) + Math.PI / 2)
  320.  
  321. const newPitch = Math.clamp(-Math.asin(newAimVector.y), -1.5, 1.5);
  322.  
  323. us.pitch || newPitch || 0
  324. us.yaw = newYaw || 0
  325.  
  326.  
  327. }
  328.  
  329. window.predictAim = function(me, target, targetVelocity, bulletSpeed) {
  330. const aimPos = target.add(targetVelocity.scale(BABYLON.Vector3.Distance(me, target) / bulletSpeed) );
  331. return aimPos;
  332. }
  333.  
  334.  
  335. const clearRect =requestAnimationFrame;
  336. let update = performance.now();
  337.  
  338. requestAnimationFrame = function(){
  339.  
  340. window.players.forEach((obj, ts) =>{
  341. if(obj.ws){
  342. window.myPlayer = obj;
  343. window.players.delete(obj.id);
  344. }
  345. });
  346. if(window.myPlayer){
  347.  
  348. const deltaShotSpread = myPlayer.shotSpread - lastShotSpread;
  349. const deltaTime = performance.now() - update;
  350.  
  351. update = performance.now();
  352. lastShotSpread = myPlayer.shotSpread;
  353.  
  354. if(!window.settings.FreezeFrame){
  355. Object.defineProperty(window.myPlayer.scene.cameras[0], 'Speed', {
  356. get: () => {
  357. return window.settings.Speed;
  358. }
  359. });
  360.  
  361. window.settings.FreezeFrame=true;
  362.  
  363. Object.defineProperty(window.myPlayer.scene, 'forceWireframe', {
  364. get: () => {
  365. return window.settings.WireFrame;
  366. }
  367. });
  368.  
  369. window.settings.HasPwned=true;
  370. window.settings.FreeSkins=true;
  371.  
  372.  
  373. }
  374. let ret = getNearest(window.myPlayer, window.players);
  375. if(ret.object && window.settings.aimbot){
  376. window.lookAtHead(window.myPlayer, ret.object, ret.dist, deltaShotSpread, deltaTime);
  377.  
  378. }else{
  379. }
  380. }
  381. return clearRect.apply(this,arguments);
  382. }
  383.  
  384. //Credit: TDStuart
  385.  
  386. function espCalc(){
  387. ctx.clearRect(0, 0, canvas.width, canvas.height);
  388. var box_size_x=2;
  389. var box_size_y=2.5;
  390. function calcDistance(mx, my, mz, ex, ey, ez) {
  391. return Math.sqrt((mx - ex) ** 2 + (my - ey) ** 2 + (mz - ez) ** 2)
  392. };
  393. for(var ply = 0; ply < players.length; ply++) {
  394. var plys = players[ply];
  395. if(plys != undefined) {
  396. if(plys.id != me.id) {
  397. var distance = calcDistance(me.x, me.y, me.z, plys.x, plys.y, plys.z);
  398. if(me.id != plys.id && plys["playing"] && plys["hp"] > 0) {
  399. var aim_pitch;
  400. var aim_yaw;
  401. var mx = me.x;
  402. var my = me.y;
  403. var mz = me.z;
  404. var ex = plys.x;
  405. var ey = plys.y;
  406. var ez = plys.z
  407. var dx = mx - ex;
  408. var dy = my - ey;
  409. var dz = mz - ez;
  410. var pitch_radi;
  411. var yaw_radi;
  412. var colour = "red";
  413. var pitch_radi = (Math.atan2(dy, Math.sqrt(dx * dx + dz * dz)));
  414. var yaw_radi = -1 * (Math.atan2(dz, dx) - 1.57);
  415. if(dy >= 0) {
  416. yaw_radi += Math.PI;
  417. } else {
  418. yaw_radi -= Math.PI;
  419. }
  420. var ANG = yaw_radi - me.yaw
  421. var A = ex - mx;
  422. var B = ez - mz;
  423. var XZ = Math.sqrt(A ** 2 + B ** 2);
  424. var DZ = Math.sin(ANG) * XZ;
  425. var DX = Math.cos(ANG) * XZ
  426. var DF = Math.tan(FOV / 2) * DX;
  427. var W = c.width / 2;
  428. var H = c.height / 2;
  429. var WX = W + ((DZ / DF) * W)
  430. var ANGY = pitch_radi - me.pitch;
  431. var AY = ey - my;
  432. var XY = Math.sqrt(A ** 2 + AY ** 2);
  433. var DY = Math.sin(ANGY) * XY;
  434. var DFY = Math.cos(FOV / 2) * DY;
  435. var WY = ((c.height / 2) + (-1) * ((me.pitch - pitch_radi)) * (500)) - distance * 0.6;
  436. function drawBorder(xPos, yPos, width, height, clr) {
  437. thickness = 1;
  438. ctx.fillStyle = clr;
  439. ctx.fillRect(xPos - (thickness), yPos - (thickness), width + (thickness * 3), height + (thickness * 3));
  440. ctx.fillStyle = clr;
  441. ctx.clearRect(xPos + thickness, yPos + thickness, width - thickness, height - thickness);
  442. }
  443. function drawLine(x, y, clr) {
  444. if(x >= 0 && x <= c.width && y >= 0 && y <= c.height) {
  445. ctx.fillStyle = clr;
  446. ctx.beginPath();
  447. ctx.moveTo(c.width / 2, c.height / 2);
  448. ctx.lineTo(x, y);
  449. ctx.strokeStyle = clr;
  450. ctx.stroke();
  451. }
  452. }
  453. function drawText(text, x, y, clr) {
  454. ctx.font = "14px Georgia";
  455. ctx.fillStyle = clr;
  456. ctx.fillText(plys.name, x, y);
  457. }
  458. if (me.team == 0) {
  459. colour = "#ff0000"
  460. };
  461. if (plys["team"] == 1) {
  462. colour = "#0000ff"
  463. };
  464. if (plys["team"] == 2) {
  465. colour = "#ff0000"
  466. };
  467. var angd = yaw_radi - (me.yaw)
  468. var degrees_me_y = me.yaw * (180 / Math.PI);
  469. var degrees_them_y = yaw_radi * (180 / Math.PI);
  470. if(degrees_them_y > 360) {
  471. degrees_them_y = degrees_them_y - 360
  472. }
  473. if(degrees_them_y < 0) {
  474. ndegrees_them_y = degrees_them_y * -1;
  475. }
  476. var diffy = ((degrees_me_y) - degrees_them_y)
  477. if(diffy < -300 || diffy > 250 || (diffy >= -70 && diffy <= 70)) {
  478. if (true) {
  479. drawBorder(WX, WY, box_size_x / (distance / 100), box_size_y / (distance / 100), colour)
  480. drawLine(WX, WY, colour)
  481. drawText(plys.name, WX, WY, colour)
  482. }
  483. }
  484. }
  485. }
  486. }
  487. }
  488. }
  489.  
  490.  
  491. datgui();
  492.  
  493. function datgui(){
  494. let gui = new dat.GUI({
  495. autoplace: false,
  496. width: 300,
  497. height: 9 * 32 - 1
  498. });
  499.  
  500. // Settings
  501. let guiSettings = gui.addFolder('CrypticTech Admin Panel & Private Server');
  502. guiSettings.add(window.settings, 'AimAssist').onChange();
  503. guiSettings.add(window.settings, 'ESP').onChange();
  504. guiSettings.open();
  505. guiSettings = gui.addFolder('CrypticX Private Server');
  506. guiSettings.add(window.settings, 'PrivateServer').onChange((e)=>{
  507. });
  508. guiSettings.add(window.settings, 'ReloadPage').onChange((e)=>{
  509. window.location.reload();
  510. });
  511. guiSettings.open();
  512. guiSettings = gui.addFolder('Frame Settings');
  513. guiSettings.add(window.settings, 'WireFrame').onChange((e)=>{
  514. window.settings.WireFrame=e;
  515. alert('WireFrame Has Been Activated!!❤️');
  516. });
  517. guiSettings.add(window.settings, 'FreezeFrame').onChange((e)=>{
  518. window.settings.FreezeFrame=e;
  519. alert('Do you really want to perform this action?');
  520. });
  521. guiSettings = gui.addFolder('Player Settings');
  522. guiSettings.add(window.settings, 'Invisibility',1,5).step(0.1).onChange((e)=>{
  523. window.settings.Invisibility=e;
  524. });
  525. guiSettings.add(window.settings, 'EggSize',1,20).step(1).onChange((e)=>{
  526. window.settings.EggSize=e;
  527. });
  528. guiSettings.add(window.settings, 'Speed', 1,3).step(0.1).onChange((e)=>{
  529. window.settings.Speed=e;
  530. });
  531. guiSettings.add(window.settings, 'Render',0,10).step(1).onChange((e)=>{
  532. window.settings.Render=e;
  533. });
  534. guiSettings.add(window.settings, 'Recoil',0,4).step(0.4).onChange((e)=>{
  535. window.settings.Recoil=e;
  536. });
  537. guiSettings = gui.addFolder('Follow My Socials!! 💬');
  538. guiSettings.add(window.settings, 'Instagram').onChange((e)=>{
  539. });
  540. guiSettings.add(window.settings, 'TikTok').onChange((e)=>{
  541. });
  542. guiSettings.add(window.settings, 'YouTube').onChange((e)=>{
  543. });
  544. guiSettings.open();
  545. guiSettings = gui.addFolder('Credits');
  546. guiSettings.add(window.settings, 'Creator').onChange((e)=>{
  547. });
  548. guiSettings.add(window.settings, 'Collaborator').onChange((e)=>{
  549. });
  550. guiSettings.add(window.settings, 'Programmers').onChange((e)=>{
  551. });
  552. guiSettings.open();
  553. document.getElementsByClassName("dg ac")[0].style.zIndex=9999;
  554. return gui;
  555. }
  556. })();
  557. // ==UserScript==
  558. // @name Performance Monitor w/ Ping
  559. // @description Shows Fps, Ping, & Memory Usage. All Sites Are Included!
  560. // @version 1.5.5
  561. // @author CrypticX
  562. // @namespace https://greasyfork.org/users/827487
  563. // @compatible Chrome
  564. // @compatible Opera
  565. // @compatible Firefox
  566. // @icon https://i.imgur.com/MrU4sID.png
  567. // @include https://*
  568. // @include http://*
  569. // @grant none
  570. // @license LGPL-3.0-or-later
  571. // ==/UserScript==
  572. 'use strict';
  573. (function(window, e) {
  574. if ("object" === typeof exports && "undefined" !== typeof module) {
  575. module.exports = e();
  576. } else {
  577. if ("function" === typeof define && define.amd) {
  578. define(e);
  579. } else {
  580. window.Stats = e();
  581. }
  582. }
  583. })(this, function() {
  584. var init = function() {
  585. function addPanel(panel) {
  586. container.appendChild(panel.dom);
  587. return panel;
  588. }
  589. function showPanel(id) {
  590. var i = 0;
  591. for (; i < container.children.length; i++) {
  592. container.children[i].style.display = i === id ? "block" : "none";
  593. }
  594. p = id;
  595. }
  596. var p = 0;
  597. var container = document.createElement("div");
  598. container.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";
  599. container.addEventListener("click", function(event) {
  600. event.preventDefault();
  601. showPanel(++p % container.children.length);
  602. }, false);
  603. var beginTime = (performance || Date).now();
  604. var prevTime = beginTime;
  605. var value = 0;
  606. var msPanel = addPanel(new init.Panel("PING", "#fff", "#000"));
  607. var fpsPanel = addPanel(new init.Panel("FPS", "#0ff", "#002"));
  608. if (self.performance && self.performance.memory) {
  609. var memPanel = addPanel(new init.Panel("MB", "#f08", "#201"));
  610. }
  611. showPanel(0);
  612. return {
  613. REVISION : 16,
  614. dom : container,
  615. addPanel : addPanel,
  616. showPanel : showPanel,
  617. begin : function() {
  618. beginTime = (performance || Date).now();
  619. },
  620. end : function() {
  621. value++;
  622. var time = (performance || Date).now();
  623. msPanel.update(time - beginTime, 200);
  624. if (time > prevTime + 1E3 && (fpsPanel.update(1E3 * value / (time - prevTime), 100), prevTime = time, value = 0, memPanel)) {
  625. var m = performance.memory;
  626. memPanel.update(m.usedJSHeapSize / 1048576, m.jsHeapSizeLimit / 1048576);
  627. }
  628. return time;
  629. },
  630. update : function() {
  631. beginTime = this.end();
  632. },
  633. domElement : container,
  634. setMode : showPanel
  635. };
  636. };
  637. init.Panel = function(label, container, position) {
  638. var t = Infinity;
  639. var val = 0;
  640. var round = Math.round;
  641. var r = round(window.devicePixelRatio || 1);
  642. var w = 80 * r;
  643. var h = 48 * r;
  644. var right = 3 * r;
  645. var padding = 2 * r;
  646. var x = 3 * r;
  647. var y = 15 * r;
  648. var width = 74 * r;
  649. var height = 30 * r;
  650. var elem = document.createElement("canvas");
  651. elem.width = w;
  652. elem.height = h;
  653. elem.style.cssText = "width:150px;height:95px";
  654. var context = elem.getContext("2d");
  655. context.font = "bold " + 10 * r + "px Helvetica,Arial,sans-serif";
  656. context.textBaseline = "top";
  657. context.fillStyle = position;
  658. context.fillStyle = container;
  659. context.fillText(label, right, padding);
  660. return {
  661. dom : elem,
  662. update : function(i, radius) {
  663. t = Math.min(t, i);
  664. val = Math.max(val, i);
  665. context.fillStyle = position;
  666. context.globalAlpha = 1;
  667. context.fillRect(0, 0, w, y);
  668. context.fillStyle = container;
  669. context.fillText(round(i) + " " + label + " (" + round(t) + "-" + round(val) + ")", right, padding);
  670. }
  671. };
  672. };
  673. return init;
  674. });
  675.  
  676. (function() {
  677. 'use strict';
  678.  
  679. const stats = new Stats();
  680. const statsParentNode = document.body;
  681.  
  682. statsParentNode.appendChild(stats.dom);
  683.  
  684.  
  685. requestAnimationFrame(function loop() {
  686. stats.update();
  687. requestAnimationFrame(loop);
  688. });
  689. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement