1.0.2-alpha • Published 6 months ago

web-engine-canvas v1.0.2-alpha

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Web Engine Canvas

A simple, lightweight and completely dependency free canvas engine. Create games, complex animations or specialized business solutions.

Direct usage in your project as ES6 NativeModules or via TypeScript.

Examples

Information

Concept

The engine follows a simple concept scenes with entities:

  • A scene is a component that consumes entities and calls three phases for them.
  • A entity is a component that can react to every scene phase.

Scene Phases:

  1. Update: Update programmatic logic for the entity.
  2. Collision: Handle collisions with other entities.
  3. Draw: Display the entity on the canvas.

Quick Setup

  1. Install the package.
npm install web-engine-canvas
  1. Embed the WebComponent within your page.
<engine-canvas id="webcomponent-id"></engine-canvas>
  1. Retrieve the engine from the WebComponent.
import { EngineCanvas } from "[EnginePath]/engineCanvas.js";

const engine = EngineCanvas.getEngine("webcomponent-id", window);
  1. Initialize your assets.
const assetsFactory = new FactoryAssets();
const assets = assetsFactory.create();

assets.addImage(...);
assets.addAudio(...);

await assets.loadImagesAsync();
await assets.loadAudiosAsync();
  1. Create your scenes and entities.
const scene = new Scene(assets);
scene.push(...new Entity());

engine.push(scene);
  1. Start the engine.
engine.start();

License

The Web Engine Canvas is licensed under MIT. See the license file for more details.

1.0.2-alpha

6 months ago

1.0.1-alpha

6 months ago

1.0.0-alpha

6 months ago