Visual Fiha implements 3 different types of layer to serve different goals.
The canvas layer is meant for 2d animation and its API is based on the DOM Canvas API but is tweaked for live coding convenience. The scope of the layer script is more or less a 2d canvas element context.
Original DOM Canvas API:
const context = document.getElementById('canvas').getContext('2d'); context.fillStyle = 'lime'; context.fillRect(0, 0, context.canvas.width, context.canvas.height);
Would be written as follow in the Visual Fiha canvas layer script:
fillStyle('lime'); fillRect(0, 0, width(), height());
This layer type is meant to animate 3d scenes. In the scripts (setup and animation) have the following globals defined:
camera: is an instance of a
scene: is an instance of a
renderer: is an instance of a
Note: in order to have something rendered, you need to call the “renderer.render” method with the “scene” and “camera” at the end of the animation script of the layer like that:
Implements the paper.js library.