1.1.2 • Published 9 months ago

beetles v1.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Beetles Animation Beetle Animation

Animation of moving beetles for HTML5 canvas. This package provides classes to control the animation, create beetles and control the size of the canvas.

Installation

Install the package via npm:

npm install beetles

Usage

After installing the package, import and create an instance of BeetlesAnimation to initialize the beetles animation on your canvas.

import BeetlesAnimation from 'beetles';

// Initialize the animation on the kanvas with the specified ID
var beetlesAnimation = new BeetlesAnimation({
    canvasId: 'canvas',         // Canvas ID 
    quantity: 100,              // Number of beetles on the screen
    maxSpeed: 5,                // Maximum speed of beetles
    beetleWidth: 12,            // Beetle width
    beetleHeight: 19,           // Beetle height
    imgSrc: 'img/beetle.webp'   // Path to beetle sprite
});

React.js Example:

import { useEffect } from "react";
import BeetlesAnimation from 'beetles';

function App() {

  useEffect(() => {
    new BeetlesAnimation({
        canvasId: 'canvas123',
        quantity: 300,
        beetleWidth: 8,
        beetleHeight: 15
    });
  }, []);

  return (
    <>
      <canvas id="canvas123"></canvas>
    </>
  );
}

export default App;
ParameterTypeDescription (optional)Default value
canvasIdstringcanvas element ID'canvas'
quantitynumbernumber of bugs on screen100
maxSpeednumberMaximum speed of the beetles5
beetleWidthnumberbeetle width (in pixels)12
beetleHeightnumberbeetle height (in pixels)19
imgSrcstringbeetle image path'beetle.webp'

Have fun Beetle Animation Beetle Animation Beetle Animation

1.1.2

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago