JavaScript version of Morphic
Last updated at 9:36 am UTC on 7 August 2020
Jens Moenig did a JavaScript version of Morphic.
Repository: https://github.com/jmoenig/morphic.js/releases. morphic.js-2.1.zip is just 110kb!
Morphic.js is based on ideas from the Squeak implementation but a complete rewrite of a minimal morphic system. It is used in Snap!
It offers the basics to do classic Morphic programming in JavaScript.
Example:
Squeak code
m1 := Morph new.
m1 position: 0 @ 0.
m1 extent: 480@ 60.
m1 color: (Color r: 0.0 g: 0.0 b: 1.0).
Javascript code
m1 = new BoxMorph();
m1.setPosition(new Point(0, 0));
m1.setExtent(new Point(480, 60));
m1.setColor(new Color(0, 0, 255));
Morphic.js - overview
Morphic.js - programming guide
Full documentation (2017).
https://github.com/jmoenig/morphic.js/blob/master/morphic.txt#L1099
citation:
This Morphic implementation for JavaScript is not a direct port of
Squeak's Morphic, but still many individual functions have been
ported almost literally from Squeak, sometimes even including their
comments, e.g. the morph duplication mechanism fullCopy(). Squeak
has been a treasure trove, and if morphic.js looks, feels and
smells a lot like Squeak, I'll take it as a compliment.