Bentley Jensen
var canvas=document.getElementById('canvas'); var ctx = canvas.getContext('2d'); ctx.canvas.width = window.innerWidth; ctx.canvas.height = window.innerHeight; var primus = Primus.connect('laptop.local/draw'); primus.on('open', function () { console.log("Connection is Open."); primus.write("requestLog"); }); primus.on('data', function (data) { console.log(data); if(data.id=='dot'){ var xLog = data.xCoord; var yLog = data.yCoord; var userColorLog=data.color; var dotSizeLog=data.diam; //draw the circle ctx.beginPath(); //x-pos, y-pos, diameter, start angle, end angle in radians ctx.arc(xLog,yLog,dotSizeLog,0,2*Math.PI); ctx.fillStyle=userColorLog; ctx.fill(); } if (data=='erased!') { ctx.clearRect(0, 0, canvas.width, canvas.height); }; });
This is a blockqoute!Line 2Luke?