5){
theMix-=5;
} else {
dir=false;
}
}
//add gradient line
linez.addLine(new Line3D(linez, new LineMaterial(theColor1*theMix), 10, new Vertex3D(lastX, lastY, lastZ), new Vertex3D(nextX, nextY, nextZ)));
}
//update last positions
lastX = nextX;
lastY = nextY;
lastZ = nextZ;
} else if(count == 315) {
//connect the final line
if(theColor2 == 0x00000f){
linez.addLine(new Line3D(linez, new LineMaterial(theColor1), 10, new Vertex3D(lastX, lastY, lastZ), new Vertex3D(firstX, firstY, firstZ)));
} else {
linez.addLine(new Line3D(linez, new LineMaterial(theColor1*theMix), 10, new Vertex3D(lastX, lastY, lastZ), new Vertex3D(firstX, firstY, firstZ)));
}
}
//render
paperCanvas.view.singleRender();
}
//________________________________________________________
// reset linez
private function setupLinez():void {
linez.material.destroy();
linez.removeAllLines();
linez.lines = [];
phi = 0;
count = 0;
p = theP.value;
q = theQ.value;
}
//________________________________________________________
// gui
private function switchMenu(dir:String):void {
if(dir == "open"){
currentState = "customColor";
colorPanel.x = btnColor.x - 40;
} else {
currentState = "";
}
}
//________________________________________________________
// change line color
private function setColor(color1:uint, color2:uint = 0x00000f):void {
theColor1 = color1;
theColor2 = color2;
setupLinez();
currentState = "";
}
//________________________________________________________
// move camera
private function fov():void {
paperCanvas.view.camera.z = theZoom.value;
}
]]>