pet-panda

2.1.1 • Public • Published

Pet Panda

A simple virtual pet panda to embed on any webpage.

NPM Package Version GitHub Sponsors Patreon Slack


Usage

To get started with the Panda, include the pet-panda script in your own JavaScript file and spawn a new Panda in your chosen container:

const Panda = require('pet-panda');

document.addEventListener('DOMContentLoaded', () => {
    new Panda(document.body);
});

This will automatically include the needed styling to render the Panda and its Bamboo. The world the Panda lives in will expand to fill the container that you give it, with the Panda exploring along the bottom edge and the Bamboo slowly growing the full height of the world.

The scale of the Panda's world can also be customised, such as setting the Panda's world to be zoomed out at 2x the world size in the same given container:

const Panda = require('pet-panda');

document.addEventListener('DOMContentLoaded', () => {
    new Panda(document.body, { worldScale: 2 });
});

Supported options for the object passed as the second argument are as follows:

  • worldScale -- Defaults to 1, a float value for the scale of the Panda's world in the container.
  • shootCount -- Defaults to 5, an integer number of Bamboo shoots to spawn in the Panda's world.
  • shootHeight -- Defaults to 80, a float value for the base Bamboo segment height (will be random within 25%).
  • debugMessages -- Defaults to false, a toggle to enable state debug messages for the Panda.

Contributing

Contributions are always welcome to this project!
Take a look at any existing issues on this repository for starting places to help contribute towards, or simply create your own new contribution to the project.

Please make sure to follow the existing standards within the project such as code styles, naming conventions and commenting/documentation.

When you are ready, simply create a pull request for your contribution and I will review it whenever I can!

Donating

You can also help me and the project out by sponsoring me through GitHub Sponsors (preferred), contributing through a donation on PayPal or by supporting me monthly on my Patreon page.

GitHub Sponsors Patreon PayPal

Discussion, Support and Issues

Need support with this project, have found an issue or want to chat with others about contributing to the project?

Please check the project's issues page first for support & bugs!

Not found what you need here?

  • If you have an issue, please create a GitHub issue here to report the situation, include as much detail as you can!
  • or, You can join our Slack workspace to discuss any issue, to get support for the project or to chat with contributors and myself:
Slack

Readme

Keywords

none

Package Sidebar

Install

npm i pet-panda

Weekly Downloads

16

Version

2.1.1

License

Apache-2.0

Unpacked Size

42.7 kB

Total Files

5

Last publish

Collaborators

  • mattipv4