//////////////////////
//Dots- 50000      //
//Code By Ayoros  //
///////////////////

function part20() {
    this.vbl = 0 ;
    this.canvaspart;
    this.text = new text_cursor() ;
    this.initdone = 0 ;

var angle1=0.0;
var angle2=0.0;
var angle3=0.0;
var angle_inc1=0.0052;
var angle_inc2=0.0201;
var angle_inc3=0.0121;
var angle_inc4=0.0075;
var angle_inc5=0.0091;
var angle_inc6=0.0091;
var angle_inc7=0.0075;
var evol=0;
var num_dots=50000;
var alpha_fade=0;
var fade_end=0;
var mycanvas2;
var frameBuffer;
var canvasImgData;

 this.init=function(){mycanvas2=new canvas(600,400);this.text.init(choix_text[1],10,8,font_key);canvasImgDST=mycanvas2.contex.createImageData(600,400);frameBuffer=canvasImgDST.data;this.initdone=1};
function dots_anim(){angle1+=angle_inc1;angle2+=angle_inc2;angle3+=angle_inc3;canvasImgDST=mycanvas2.contex.createImageData(600,400);frameBuffer=canvasImgDST.data;for(var b=0,e=0,a=0,c=0,d=0,f=0,g=0,h=f=0;h<num_dots;h++)f=Math.cos(angle2+a)*Math.cos(angle3+c),g=Math.sin(angle3+c)*Math.cos(angle1+d),b=200+100*(Math.sin(angle1+a)+f),e=200+100*(g+Math.sin(angle2+a)),0<evol&&250>evol&&(a-=angle_inc5+angle_inc4,c+=angle_inc6+angle_inc5,d+=angle_inc7),250<=evol&&500>evol&&(a-=angle_inc5+angle_inc4,c+=angle_inc6+
angle_inc5,d+=angle_inc7+angle_inc6),500<=evol&&750>evol&&(a-=angle_inc5,c+=angle_inc6,d+=angle_inc7+angle_inc5),750<=evol&&1E3>evol&&(a-=angle_inc5,c+=angle_inc6+angle_inc5,d+=angle_inc7),f=0|60*(2+f+g),drawsimpleObj(0|b,0|e,frameBuffer,f);30>=fade_end&&(alpha_fade+=0.02);230<=fade_end&&250>fade_end&&(alpha_fade-=0.02);250==fade_end&&(fade_end=alpha_fade=0);fade_end++;evol++;1E3<=evol&&(evol=0)}
function drawsimpleObj(b,e,a,c){0<=e&&0<=b&&400>e&&600>b&&(b=600*e+b<<2,a[b++]=c,a[b++]=c,a[b++]=c+155,a[b]=255)}
this.render=function(b){0==this.initdone&&(this.canvaspart=new canvas(600,400),this.init());this.canvaspart.fill("rgba(0,0,0,0.2)");mycanvas2.clear();dots_anim();mycanvas2.contex.putImageData(canvasImgDST,0,0);mycanvas2.draw(this.canvaspart,100,0,alpha_fade);this.text.render(this.canvaspart,choix_pos[1].x,choix_pos[1].y);this.canvaspart.draw(b,60,88);100>this.vbl&&mycanvasblack.draw(b,60,88,1-this.vbl/100);this.vbl>intro_parts[part_running].part_duration-100&&mycanvasblack.draw(b,60,88,1-(intro_parts[part_running].part_duration-
this.vbl)/100);this.vbl++};
return this;
}
//////////////
//END PART20//
////////////
