0.39.0 • Published 12 months ago

@litecanvas/litecanvas v0.39.0

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

image

litecanvas

Discord Server

Lightweight HTML5 canvas engine suitable for small games and animations for people who enjoy coding: there is no fancy interface, no visual helpers, no gui tools... just coding.

:warning: This project is still under development. All feedback is appreciated! :warning:

Features

  • Tiny: only ~4KB (minified + gzipped).
  • Simple API: just few functions to draw shapes and some utilities to other things like sounds and math.
  • Offline-first: You can install the playground as webapp and use anywhere at any time.
  • Predefined colors: just use a number (from 0 to 11) to choose a color in our 12-color palette.
  • Predefined sounds: packed with 4 sounds created in ZzFX.

Learn more

Getting Started

You can try our online playground or just installing the basic template:

# requires Node.js
npx tiged litecanvas/template my-game
cd my-game
npm install
npm start

If you prefer, you can manually install the package via NPM:

npm install @litecanvas/litecanvas
import litecanvas from '@litecanvas/litecanvas'

// you can setup other configurations here
// learn more in the cheatsheet
litecanvas({
    loop: { init, update, draw },
})

// run once before the game starts
function init() {
    bg = 0
    color = 3
    posx = CENTERX
    posy = CENTERY
}

// called at 60 fps by default
// use to update your things
function update(dt) {
    // example: tap to change the circle position
    if (TAPPED) {
        posx = TAPX
        posy = TAPY
    }
}

// use to draw your things
function draw() {
    clear(bg) // clear the screen
    circfill(posx, posy, 50, color) // draw a circle
}

Docs

Check out our Cheatsheet.

Basic Demos

Try some demos in our playground:

See other demos in samples folder

Inspirations

  • floppy: a micro game engine for beginners.
  • PICO-8: fantasy console for making, sharing and playing tiny games.
  • js13kGames: a JavaScript coding competition with size limit set to 13 kilobytes.
  • raylib: a simple and easy-to-use gamedev library.
  • p5.js/Processing: a library for creative coding.
0.38.0

12 months ago

0.36.0

1 year ago

0.34.2

1 year ago

0.34.1

1 year ago

0.34.0

1 year ago

0.39.0

12 months ago

0.37.1

12 months ago

0.37.0

1 year ago

0.35.0

1 year ago

0.33.2

1 year ago

0.33.1

1 year ago

0.33.0

1 year ago

0.32.0

1 year ago

0.31.0

1 year ago

0.30.0

1 year ago

0.29.0

1 year ago

0.28.0

1 year ago

0.27.0

1 year ago

0.26.1

1 year ago

0.26.0

1 year ago

0.25.0

1 year ago

0.24.1

1 year ago

0.24.0

1 year ago

0.23.1

1 year ago

0.23.0

1 year ago

0.22.0

1 year ago

0.21.0

1 year ago

0.20.0

1 year ago

0.21.1

1 year ago

0.19.0

1 year ago

0.19.1

1 year ago

0.18.0

1 year ago

0.15.0

1 year ago

0.16.0

1 year ago

0.17.0

1 year ago

0.14.0

1 year ago

0.13.0

1 year ago

0.12.2

1 year ago

0.12.0

1 year ago

0.12.1

1 year ago

0.11.0

1 year ago

0.11.1

1 year ago

0.10.0

1 year ago

0.10.1

1 year ago

0.9.0

1 year ago

0.8.1

1 year ago

0.8.0

1 year ago

0.7.0

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.5.0

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.2

1 year ago

0.1.0

1 year ago