Can't save the project


#22

Hey, @MisterMender @Luxapodular
Sorry to bother u, I have a question, I want to make a random triangle, and I find the code for Javascript in HTML

window.onload = function(){

var previewButton = document.getElementById("previewButton");
previewButton.onclick = previewButtonHandler;

previewButtonHandler();

//setInterval(previewButtonHandler, 500);

}

function previewButtonHandler()
{
var canvas = document.getElementById(“canvasView”);

var context = canvas.getContext("2d");

clearCanvas(canvas, context);

drawTriangle(canvas, context);

}

function drawTriangle(canvas, context)
{
context.beginPath();
context.moveTo(getRandom(canvas.width), getRandom(canvas.height));
context.lineTo(getRandom(canvas.width), getRandom(canvas.height));
context.lineTo(getRandom(canvas.width), getRandom(canvas.height));
context.closePath();

context.lineWidth = 1; 
context.stroke(); 
context.fillStyle = getRandomColor(); 
context.fill(); 

}

function getRandom(bound)
{
return Math.floor(Math.random() * bound);
}

function clearCanvas(canvas, context)
{
context.fillStyle = “white”; context.fillRect(0, 0, canvas.width, canvas.height); }

and my question is in wick editor, Is there a parameter like 2d that can call the brush function, or maybe there are other ways to implement this function


#23

Hey @andy,

Unfortunately, the Wick Editor doesn’t have a way to draw with code quite yet. We’ll be looking into this in Wick Editor 1.0, but aren’t sure what the best way to add it in is quite yet.


#24

Oh, that 's ok, just asking, I can find another way to develop my project, thank you for your reply~
have a nice day!