Malkasten & MatrixCanvas technical demos

These demonstrations represent several steps on the way to build a browser game and other capabilities of the included classes.

Press [Space] to pause each demo. Reload each page to start the demo again.

Source Code

gitlab.com/feeela/js-utils
My library without a name – a set of often used JavaScript utilities, helper functions and modules.
gitlab.com/feeela/malkasten
This repository contains classes to paint on a canvas.
Malkasten
Malkasten is the basic canvas wrapper class that uses percentage coordinates to draw on a canvas. It has animation capabilities, stacks contents in layers, uses CSS sizing for the canvas, and scales according to window.devicePixelRatio.
MatrixCanvas
Extends Malkasten and uses an internal 2D array of fields (tiles) to paint objects in a grid.
Utilities
The Malkasten repository also contains classes for simple 2D geometry (Vector, Point), loop distinct pieces of code in a given order (ActionRunner), render text on a canvas (Text, TextBlock & TextBlockWrap), and display a keyboard controllable navigation (Menu).
gitlab.com/feeela/spiele.imstadtpark.de
The repositiory containing the games and examples on this website.

MatrixCanvas & Matrix

Basic grid

Matrix objects

MatrixObjects may have one or more behaviors assigned.

Matrix based layout with collision detection

Path finding algorithm

Perlin noise and pre-game tests

Miscellaneous demos

Text Block
Print text on a canvas; has colors and backgrounds with padding
Text Block with Webfont
Print text on a canvas; same as above but uses a webfont.
Color
Demo for class Color, which contains color helper functions
Menu
On-canvas menu with keyboard selection
Pixelate
Rasterize a given image
Export
Some Malkasten objects can be serialized as JSON; here's an overview of which objects do describe themselves.

Mouse interaction

Pointer Control
Now you place the walls yourself, click-a-di-click.
Pixel Paint
Paint a pixel graphic by placing or removing single pixels.

Malkasten

The Malkasten is a Canvas class without using the matrix. It provides basic drawing and other helper methods.

Random number demos

Colony (Random number demos #2)

Colonies are a swarm of points and are storing points as an internal list (array). For each point a full check of each possible neighbour is performed, and as long as there are free neighbouring points a new point will be added (fills up entire screen). A colony has the feature to block points via pushing points to the static class property Colony.doNotStepOn and thus prevent itself and other Colonies from stepping on that same point again.

Malkasten Helper

Malkasten miscellaneous