This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| oneko.js [2026/05/12 23:58] – created Yuki | oneko.js [2026/05/13 00:12] (current) – Yuki | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | / | ||
| /*<code javascript> | /*<code javascript> | ||
| // oneko.js: https:// | // oneko.js: https:// | ||
| Line 25: | Line 24: | ||
| let idleAnimationFrame = 0; | let idleAnimationFrame = 0; | ||
| - | const nekoSpeed = 10; | + | const nekoSpeed = 8; |
| const spriteSets = { | const spriteSets = { | ||
| - | idle: [[-3, -3]], | + | idle: [[0, 0]], |
| alert: [[-7, -3]], | alert: [[-7, -3]], | ||
| scratchSelf: | scratchSelf: | ||
| Line 62: | Line 61: | ||
| ], | ], | ||
| NE: [ | NE: [ | ||
| - | [0, -2], | + | [-3, -3], |
| + | [-2, -3], | ||
| + | [-1, -3], | ||
| [0, -3], | [0, -3], | ||
| ], | ], | ||
| Line 72: | Line 73: | ||
| ], | ], | ||
| SE: [ | SE: [ | ||
| - | [-5, -1], | + | [-3, -2], |
| - | [-5, -2], | + | [-2, -2], |
| + | [-1, -2], | ||
| + | [0, -2], | ||
| ], | ], | ||
| S: [ | S: [ | ||
| Line 94: | Line 97: | ||
| ], | ], | ||
| NW: [ | NW: [ | ||
| - | [-1, 0], | + | [-3, -1], |
| + | [-2, -1], | ||
| [-1, -1], | [-1, -1], | ||
| + | [0, -1], | ||
| ], | ], | ||
| }; | }; | ||
| Line 131: | Line 136: | ||
| nekoEl.ariaHidden = true; | nekoEl.ariaHidden = true; | ||
| nekoEl.style.width = " | nekoEl.style.width = " | ||
| - | nekoEl.style.height = "32px"; | + | nekoEl.style.height = "48px"; |
| nekoEl.style.position = " | nekoEl.style.position = " | ||
| nekoEl.style.pointerEvents = " | nekoEl.style.pointerEvents = " | ||
| Line 198: | Line 203: | ||
| // every ~ 20 seconds | // every ~ 20 seconds | ||
| - | if ( | + | |
| idleTime > 10 && | idleTime > 10 && | ||
| Math.floor(Math.random() * 200) == 0 && | Math.floor(Math.random() * 200) == 0 && | ||
| Line 220: | Line 225: | ||
| Math.floor(Math.random() * avalibleIdleAnimations.length) | Math.floor(Math.random() * avalibleIdleAnimations.length) | ||
| ]; | ]; | ||
| - | } | + | }*/ |
| switch (idleAnimation) { | switch (idleAnimation) { | ||
| - | case " | + | |
| if (idleAnimationFrame < 8) { | if (idleAnimationFrame < 8) { | ||
| setSprite(" | setSprite(" | ||
| Line 242: | Line 247: | ||
| resetIdleAnimation(); | resetIdleAnimation(); | ||
| } | } | ||
| - | break; | + | break;*/ |
| default: | default: | ||
| setSprite(" | setSprite(" | ||
| Line 264: | Line 269: | ||
| idleAnimationFrame = 0; | idleAnimationFrame = 0; | ||
| - | if (idleTime > 1) { | + | |
| setSprite(" | setSprite(" | ||
| // count down after being alerted before moving | // count down after being alerted before moving | ||
| Line 270: | Line 275: | ||
| idleTime -= 1; | idleTime -= 1; | ||
| return; | return; | ||
| - | } | + | }*/ |
| let direction; | let direction; | ||