xxxxxxxxxx
117
var mgr;
var xpos = 0;
var xpos2 = 50;
var xpos3 = 400;
function setup() {
createCanvas(400, 400);
mgr = new SceneManager();
mgr.addScene(Scene1);
mgr.addScene(Scene2);
mgr.addScene(Scene3);
mgr.wire();
mgr.showNextScene();
}
function draw() {
//mgr.draw();
}
function Scene1 () {
this.enter = function() {
fill(255, 0, 0);
}
this.draw = function () {
background("#4F99FF");
rectMode(CENTER);
noStroke();
xpos++;
ellipse(200,200,xpos);
if(xpos > 401)
{
mgr.showScene(Scene2);
xpos = 0;
}
}
}
function Scene2 () {
this.enter = function() {
fill(255, 0, 0);
}
this.draw = function () {
background('yellow');
ellipseMode(CENTER);
xpos2++;
rect(200, 200, xpos2, xpos2);
if(xpos2 > 401)
{
mgr.showScene(Scene3);
xpos2 = 0;
}
}
}
function Scene3 () {
this.enter = function() {
fill(255, 0, 0);
}
this.draw = function () {
background("pink");
ellipseMode(CENTER);
xpos3--;
if(xpos3 < 10)
{
mgr.showScene(Scene1);
xpos3 = 0;
}
fill(255);
ellipse(200,200, xpos3, xpos3);
}
}