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

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

Revision as of 16:11, 14 August 2019

var v= 1; var locationX=0; var locationY=0; function setup() {

 // put setup code here
   createCanvas(window.innerWidth, window.innerHeight);

}

function draw() {

 // put drawing code here
   locationX = locationX+v;
   locationY = locationY+v;
   colorMode(HSB);
   background(255, 204, 100);
   ellipse(mouseX,mouseY,80,80);

}