Snap! (programming language): Difference between revisions

Content deleted Content added
Platforms: split into two sections (i.e. itself and the new, 'Implementation', section)
Line 78:
Although Snap''!'' is implemented in JavaScript using an [[HTML5]] Canvas [[application programming interface]] (API), it is actually built on top of ''Morphic.js''<ref name="morphic_js">{{cite web |last1=Mönig |first1=Jens |title=morphic.js |url=https://github.com/jmoenig/morphic.js/blob/master/morphic.txt |website=GitHub |accessdate=7 June 2023}}</ref>, a [[Morphic (software)|Morphic]] GUI, which serves as 'middle layer' between Snap! itself and 'bare' JavaScript.
 
All things visible in Snap''!'' are morphs themselves, i.e. all buttons, sliders, dialog boxes, menus,entry fields, text rendering, blinking cursors etc. are created with morphic.js rather than using HTML DOM elements. AllSnap! usercaches interactionthe isshapes triggeredof by[[sprite]]s events,so whichthe aresprite passeddoesn't onhave fromto thebe rootre-drawn onto a new Canvas element -every time the Worldmouse -moves toover its submorphsbounding box. It does not cache blocks, however. Instead it manages the insides of C- and E-shaped blocks through the morphic "holes" mechanism.
 
All user interaction is triggered by events, which are passed on from the root element - the World - to its submorphs. Dropping a morph causes it to become embedded in a new 'owner' ('parent') morph. In Morphic the preferred way to run an animation is to register it with the World by adding it to the World's animation queue. The World steps each registered animation once per display cycle independently of the Morphic stepping mechanism.
 
==Recognition==