hm1_hello_me101

rasinbow style for bonk.io

Jun 25th, 2025
38
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Bonk.io Rainbow Name & Level (Lobby + In-Game) - Smooth
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.1
  5. // @description Smooth glowing rainbow names and levels in lobby. Change speed here: setInterval(updateColors, 126) (line 64)
  6. // @author hello_me
  7. // @match *://bonk.io/*
  8. // @grant none
  9. // ==/UserScript==
  10. (function () {
  11. 'use strict';
  12. let hue = 0;
  13. let appliedElements = new Set(); // Track elements to avoid re-applying transitions
  14. function rainbowColor(h) {
  15. return `hsl(${h % 360}, 100%, 50%)`;
  16. }
  17. function applyTransition(element) {
  18. if (!appliedElements.has(element)) {
  19. element.style.transition = 'color 0.1s ease-in-out, text-shadow 0.1s ease-in-out';
  20. appliedElements.add(element);
  21. }
  22. }
  23. function updateColors() {
  24. hue = (hue + 5) % 360 // Faster color change - increased from 3.5 to 5
  25. // Apply to lobby
  26. const lobbyPlayers = document.querySelectorAll(".newbonklobby_playerentry");
  27. lobbyPlayers.forEach(player => {
  28. const nameTag = player.querySelector(".newbonklobby_playerentry_name");
  29. const levelTag = player.querySelector(".newbonklobby_playerentry_level");
  30. if (nameTag) {
  31. applyTransition(nameTag);
  32. nameTag.style.color = "#ffffff";
  33. nameTag.style.textShadow = `0 0 6px ${rainbowColor(hue)}, 0 0 12px ${rainbowColor(hue + 60)}, 0 0 18px ${rainbowColor(hue + 120)}`;
  34. nameTag.style.fontWeight = "bold";
  35. }
  36. if (levelTag) {
  37. applyTransition(levelTag);
  38. levelTag.style.color = rainbowColor(hue + 180);
  39. levelTag.style.fontWeight = "bold";
  40. }
  41. });
  42. // Apply to in-game player list (top-left scoreboard)
  43. const gamePlayers = document.querySelectorAll(".gamePlayers .gamePlayerText");
  44. gamePlayers.forEach(el => {
  45. applyTransition(el);
  46. el.style.color = rainbowColor(hue);
  47. el.style.textShadow = `0 0 6px ${rainbowColor(hue + 30)}, 0 0 12px ${rainbowColor(hue + 60)}`;
  48. el.style.fontWeight = "bold";
  49. });
  50. // Also check for other common player name selectors that might appear
  51. const otherPlayerElements = document.querySelectorAll(".playerName, .player-name, [class*='player'][class*='name']");
  52. otherPlayerElements.forEach(el => {
  53. applyTransition(el);
  54. el.style.color = rainbowColor(hue + 90);
  55. el.style.textShadow = `0 0 4px ${rainbowColor(hue + 120)}`;
  56. el.style.fontWeight = "bold";
  57. });
  58. }
  59. // Clean up tracked elements periodically to prevent memory leaks
  60. setInterval(() => {
  61. appliedElements.clear();
  62. }, 30000); // Clear every 30 seconds
  63. // Update colors every 100ms for faster animation - reduced from 150ms
  64. setInterval(updateColors, 126);
  65. // Initial update
  66. updateColors();
  67. })();
Tags: bonk.io
Advertisement
Comments
Add Comment
Please, Sign In to add comment