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