/////////////////////////
// Mutli Fractal Line //
//Code By Ayoros     //
//////////////////////
function part10() {
    this.vbl = 0 ;
    this.canvaspart;
    this.text = new text_cursor() ;
    this.initdone = 0 ;

    var M = Math;
    var coordx = 600 / 2 | 0; 
    var coordy = 480 / 2 | 0;
    tab_coord = [];

    var f = 0;
    var s = 5;
    var obj_trace=0.2;
    var twopi = 6 ;

    var colorindex ;
    var tabcolor = new Array() ;
    tabcolor[0] = "hsl(244,75%,30%)" ;
    tabcolor[1] = "hsl(24,75%,30%)" ;
    tabcolor[2] = "hsl(328,75%,30%)" ;
    tabcolor[3] = "hsl(100,55%,20%)" ;
    tabcolor[4] = "hsl(290,55%,20%)" ;

    this.init = function() {
     this.initdone = 1 ;
    
     this.text.init(choix_text[3],10,8,font_key) ;

        for (i = 6; i--;) 
        {
          tab_coord.push([coordx, coordy, Math.random() * twopi]);
        }

        colorindex = 0 ;
    
        f = 0;
        s = 5;
    }

    this.render = function(dest) {
        if (this.initdone == 0) { this.canvaspart = new canvas(600,400) ; this.init() ; }
        
        this.canvaspart.contex.globalCompositeOperation='lighter';
        if (!f && tab_coord.length <= 500) {
            tab_coord.push([coordx, coordy, Math.random() * twopi]);
        } else {
					
            this.canvaspart.clear();
            tab_coord = [];
            for (i = 6; i--;) 
            { 
            tab_coord.push([coordx, coordy, Math.random() * twopi]);
            }

            colorindex ++ ;
            colorindex = colorindex % tabcolor.length ;
            f = 0;
            s = 10;
            obj_trace=obj_trace+0.1;
            if (obj_trace>0.4) {obj_trace=0.1;}
        }
        ctx = this.canvaspart.contex ;
        ctx.beginPath() ;
        ctx.lineWidth = 0.03 ;
        ctx.strokeStyle=tabcolor[colorindex];

        for (i = tab_coord.length; i--;)
        {
            z = tab_coord[i][2];
            //this.canvaspart.line(tab_coord[i][0],tab_coord[i][1],300,252,0.01,colors);
            ctx.moveTo(300,252) ;
            ctx.lineTo(tab_coord[i][0],tab_coord[i][1]) ;
            tab_coord[i][0] += s * Math.cos(z) | 0;
            tab_coord[i][1] += s * Math.sin(z) | 0;
            if (this.vbl %2 ==0) {
                tab_coord[i][2] += obj_trace * (z / (z * 360 / twopi));
            } else {
                tab_coord[i][2] += obj_trace * Math.sqrt(z / (z * 360 / twopi));
            }
        }		
        ctx.closePath();
        ctx.stroke() ;

        this.canvaspart.draw(dest,60,88);
        this.text.render(dest,choix_pos[3].x+60,choix_pos[3].y+88) ;

        if (this.vbl<100) mycanvasblack.draw(dest,60,88,1-this.vbl/100);
        if (this.vbl>intro_parts[part_running].part_duration-100) {
            mycanvasblack.draw(dest,60,88,1-(intro_parts[part_running].part_duration-this.vbl)/100);
        }
        this.vbl++ ;
    }
return this;
}
///////////////
//END PART10//
/////////////
