Difference between revisions of "Template:Tongji Software/sketchMain"

Line 1: Line 1:
var v= 1;
+
window.onload = function () {
var locationX=0;
+
     creatCanvas(400,400)
var locationY=0;
+
function setup() {
+
  // put setup code here
+
     createCanvas(500,500);
+
 
+
 
}
 
}
  
function draw() {
+
function creatCanvas(CANVAS_WIDTH,CANVAS_HEIGHT) {
  // put drawing code here
+
     document.body.innerHTML = "<canvas id = \"mycanvas\" width=\""+CANVAS_WIDTH+"\" height=\""+CANVAS_HEIGHT+"\"></canvas>"
     locationX = locationX+v;
+
    locationY = locationY+v;
+
    colorMode(HSB);
+
    background(255, 204, 100);
+
    ellipse(mouseX,mouseY,80,80);
+
 
}
 
}

Revision as of 15:55, 14 August 2019

window.onload = function () {

   creatCanvas(400,400)

}

function creatCanvas(CANVAS_WIDTH,CANVAS_HEIGHT) {

   document.body.innerHTML = "<canvas id = \"mycanvas\" width=\""+CANVAS_WIDTH+"\" height=\""+CANVAS_HEIGHT+"\"></canvas>"

}