A JavaScript library building off of the popular oneko.js script! featuring speed configuration, custom Onekos, and other fun stuff!
Important
This project is early in development and backwards-incompatible updates will be common during this time. Sorry :(
Welcome to the lots-o-nekos
GitHub repository! This project is a JavaScript library building off of adryd325's oneko.js script. It features customization capabilities such as speed, custom Onekos, and more!
This project takes contributions from any and all! New features are always welcome, and there could always be more Onekos to choose from... if you're a pixel artist you should consider creating a custom Oneko for /~https://github.com/raynecloudy/oneko_db/ :3
- Download
lots-o-nekos.js
and your choice of cat from /~https://github.com/raynecloudy/oneko_db/ and place both files in your website's home directory. - Paste this code in the
body
tag of all HTML files:
<script src="/lots-o-nekos.js"></script>
- In a separate script, write some code with the library!
Oneko
objects are constructed using this syntax:
new Oneko();
Parameter | Meaning |
---|---|
element |
The Oneko's HTML element. |
frameCount |
How long the Oneko has been alive for, in frames. |
idleTime |
How long the Oneko has been idle for, in frames. |
source |
The path to an image file used to represent the Oneko, as a string. |
speed |
How fast the Oneko can run, in pixels. |
targetX |
The X position the Oneko is running towards, in pixels. |
targetY |
The Y position the Oneko is running towards, in pixels. |
updateSpeed |
How fast the Oneko updates its animations, in milliseconds. |
x |
The Oneko's position on the X axis, in pixels. |
y |
The Oneko's position on the Y axis, in pixels. |
Function | Meaning |
---|---|
setTarget(x: number, y: number): void |
Set the coordinates for the Oneko to run to. x and y are pixel values. |
Event | Fired when... |
---|---|
draw |
Oneko is drawn |
start_running |
Target coordinate becomes outside range, after alert animation plays |
stop_running |
Target coordinate becomes inside range |