Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Framer Canvas Example
var myCanvasView = new View({
x:100, y:100,
width:200, height:200
// Add a nice background color so we see it = "rgba(255,0,0,.5)"
// This is the tricky bit, we create a canvas element (so we have a reference to it) and insert it into the view
myCanvas = document.createElement("canvas");
// Now we get a context to draw in
myCanvasContext = myCanvas.getContext("2d");
myCanvasContext.fillStyle= "green";
myCanvasContext.fillRect(0, 0, 100, 100);

blynx commented Jul 27, 2017

new View( ) is new Layer( ) now. Also mind the indents for coffescript.

meowgorithm commented Dec 3, 2017

The above is actually JavaScript, however if you remove the var keyword, fix the indent on line 3 and change // to # it will pass as CoffeeScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment