tsneko
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

😹tsneko

tsneko is a js library which adds a neko neko to your website ~ A cat that chases the cursor on your screen

Idea and assets stolen from webneko.net

States

  • Still still
  • Alert alert
  • Run run
  • Itch itch
  • Scratch scratch1 scratch2
  • Yawn yawn
  • Sleep sleep

Styles

rainbow black valentine fancy

You can find different neko styles in example/assets/ directory.

🚀Example

You can run a demo locally:

npm install
npm run example

Navigate to http://127.0.0.1:8080 or http://localhost:8080 to see a live demo

🛠️Installation and Usage

Webpage

If you simply want to add it to your 🕸️webpage🕸️:

<script src="https://cdn.jsdelivr.net/npm/tsneko@1.0.1/_bundle/tsneko.js"></script>
<!-- then -->
<script>
  let clean = tsneko.runWebDefault();
  // optionally you can specify assets directory
  // let clean = tsneko.runWebDefault('myServerDirectory');
  // The directory should contain state images for neko
  // i.e. myServerDirectory/still.gif, myServerDirectory/itch1.gif, etc.
  // See example styles in 'example/assets'
 
  // some time later
  // call clean() to remove it from the document
  clean();
</script> 

Node

If you want to use it in your node project:

Use the node package manager npm

npm install tsneko

Import:

CommonJS

const tsneko = require('tsneko');

ES6 modules

import * as tsneko from 'tsneko';

Use:

// You can also use the neko class only (without drawing it on the screen)
let neko = tsneko.defaultNeko();
 
neko.update(cursorX, cursorY); // to update the state
 
neko.state.x, neko.state.y; // to get neko position
neko.img; // to get the image
 
// You can actually try to embed it into an electron app
// see src/web.ts for browser implementation

📑Documentation

The code is well documented using typedoc

The documentation is hosted using github pages here

To generate documentation locally:

npm run doc:gen

To host it locally

npm run doc:host

Then navigate to localhost:3228 in your web browser

🎉Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

! I would be glad if some of you javascript tryhards could kindly setup webpack or npm scripts

License

MIT

⚠️Warning⚠️

code stinks

although it shouldn't matter to you if you only want to use it

Readme

Keywords

Package Sidebar

Install

npm i tsneko

Weekly Downloads

8

Version

1.1.0

License

MIT

Unpacked Size

384 kB

Total Files

1267

Last publish

Collaborators

  • ixl