xxxxxxxxxx
let backgroundColor;
var socket = io.connect($OP.getEchoServerURL(422520));
function setup() {
backgroundColor = 255;
//size(500, 500);
createCanvas(windowWidth, windowHeight);
background(backgroundColor);
strokeWeight(10);
name = prompt("Name");
socket.on('ping', drawline);
}
function draw() {
if (mouseIsPressed == true) {
let params = [mouseX, mouseY, pmouseX, pmouseY];
socket.emit('ping', {name: name, params:params});
line(params);
}
}
function drawLine() {
}
function keyPressed() {
if (key == 'r') {
stroke(255, 0, 0);
}
if (key == 'b') {
stroke(0,0,255);
}
if (key == 'g') {
stroke(0,255,0);
}
if (key == 'w') {
stroke(255);
}
if (key == 'q') {
stroke(0);
}
if (key == 'z') {
stroke(random(-255, 255), random(-255, 255), random(-255, 255));
}
if (key == ' ') {
background(backgroundColor);
}
}
var socket = io.connect($OP.getEchoServerURL(1866112));
Learn more See an example