Marlon Barrios Solano
MULTIPLE Spline/recurrent
//
// define a function to set initial properties
// for when everything is loaded and just about ready to go
function initCanvas() {
// any code to execute once at startup goes here
}
//
// define a function to perform updates to the stage
function frameUpdate() {
// no need to modify this code, but feel free to add
// more functions
var D = new Date();
var ms = D.getMilliseconds();
drawBackground(ms);
drawCharacter(ms);
}
//
//
function drawBackground(input) {
// input = [0,999]
// insert code from task02 here
// optionally change code to incorporate input parameter
// only black background/ decided to simplify
canvas.setBackgroundColor(0, 0, 0);
}
function drawCharacter(input) {
//variables for spline
var norm = input * (1.0/999);
canvas.setPenWeight(.001);//fine lines
// counter variables
var j = 0;
var i = .015;
// draw loop
while (j < 1) {
canvas.drawLine(norm,j, j,1);//bottom left
canvas.setPenColor (Math.random(), Math.random(),Math.random());
j += i;
}
var j = 0;
var i = .015;
// draw loop
while (j < 1) {
canvas.drawLine(1,j,j,norm);//top right
canvas.setPenColor (Math.random(), Math.random(),Math.random());
j += i;
}
//opossite splines
var j = 0;
var i = .015;
// draw loop
while (j < 1) {
canvas.drawLine(norm,j, j,0); //top left stable
canvas.setPenColor (Math.random(), Math.random(),Math.random());
j += i;
}
var j = 0;
var i = .015;
// draw loop
while (j < 1) {
canvas.drawLine(0,j,j,norm);//top left stable
canvas.setPenColor (Math.random(), Math.random(),Math.random());
j += i;
}
}
//
// event handling:
// associate a function with the enterFrame event
Canvas.onEnterFrame = frameUpdate;
// associate a function with the onLoad event
this.onLoad = initCanvas;