Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- if (OWOP.bunnyRun) return OWOP.bunnyRun.toggle();
- const container = document.getElementById("toole-container");
- if (!container) return alert("Tool container not found");
- const tools = [...container.children];
- OWOP.bunnyRun = {
- active: true,
- tools: tools,
- positions: [],
- ears: [],
- setup() {
- container.style.overflow = "visible";
- this.tools.forEach((tool, i) => {
- tool.style.position = "absolute";
- tool.style.left = "0px";
- tool.style.top = i * 42 + "px";
- this.positions[i] = { x: 0, y: i * 42 };
- // Add bunny ears
- const ear = document.createElement("div");
- ear.style.position = "absolute";
- ear.style.top = "-8px";
- ear.style.left = "6px";
- ear.style.width = "8px";
- ear.style.height = "12px";
- ear.style.background = "#fff";
- ear.style.borderRadius = "4px 4px 0 0";
- ear.style.border = "1px solid #000";
- ear.style.zIndex = "9";
- tool.appendChild(ear);
- this.ears[i] = ear;
- // Hopping behavior
- tool.onmouseover = () => this.jump(i);
- });
- },
- jump(i) {
- const pos = this.positions[i];
- const dx = (Math.random() - 0.5) * 80;
- const dy = (Math.random() - 0.5) * 80;
- pos.x += dx;
- pos.y += dy;
- const tool = this.tools[i];
- tool.style.left = pos.x + "px";
- tool.style.top = pos.y + "px";
- },
- toggle() {
- this.active = !this.active;
- if (!this.active) {
- this.tools.forEach((tool, i) => {
- tool.style.left = "0px";
- tool.style.top = i * 42 + "px";
- this.positions[i] = { x: 0, y: i * 42 };
- });
- }
- }
- };
- OWOP.bunnyRun.setup();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement