var USE_SYNTH = 0; with(Math)S=sin,C=cos,M=max,N=min,P=pow; f = function(a,b,c){return eval('(function('+a+'){'+b+(b?';':'')+(c?('return '+c):'')+'})')}, getnotefreq=f('a','','.003959503758*P(2,(a-128)/12)'), mOscillators=[ f('a','','S(a*6.283184)'), f('a','','(a%1)<.5?1:-1'), f('a','','2*(a%1)-1'), f('a,b','b=(a%1)*4','(b<2)?(b-1):(3-b)') ], // Vector stuff vecOp=f('a','','f(\'a,b,c\',\'for(var i=a.length;--i>=0;)\'+a,\'a\')'), vomNew=f('a','','new Float32Array(a)'), vecNorm=f('a,b,c','c=Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2])','c?vecScale(a,b,1/c):vecCopy(a,b)'), vecCross=f('a,b,c','','vecSet(a,b[1]*c[2]-b[2]*c[1],b[2]*c[0]-b[0]*c[2],b[0]*c[1]-b[1]*c[0])'), vecSet=vecOp('a[i]=arguments[i+1]'), vecCopy=vecOp('a[i]=b[i]'), vecSub=vecOp('a[i]=b[i]-c[i]'), vecScale=vecOp('a[i]=b[i]*c'), // Shaders shaderHeader='precision highp %;varying !2 zx;', shaderFloat=f('a','','a+(a==(a|0)?\'.\':\'\')'), shaderVec=f('a','','a.map(shaderFloat).join(\',\')'); // Raymarchers materials = [[[.05],.7,.02,.01],[[.2],.7,.9,.01,5,[.1]],[[1],.5,.4,.02],[[3,0,0],.3,.1,.6,6,[.6,0,0]],[[0,2,0],.9,.5,.4,15,[0,.2,0]],[[3,1.5,0],.95,.6,.9,.3,[.3,.6,0]],[[.1],0,.04,.002,3,[3]],[[0,1.5,2],.9,.3,.4]]; raymarchers = [[100,.025,1,.7,64,.0005,.5,.3,.4,.015,4,2,.75,[0,1,2,3],'y=x+.1*(sin(x.zxy*.17+u4[0]*.5)+sin(x.yzx*.7+u4[0]*1.5))*8.5*(1.+cos(sin(x.z*.1)+x.z*.3)),z=14.-length(y.xy),w=x.x==.0?1.570795*(x.y>.0?1.:-1.):atan(x.y,x.x),q=8.35-u4[8]*1.35,y=!3(9.*(mod(w+x.z*.02,.628)-.314),length(x.xy)-9.,mod(x.z,12.56)-6.28),u=min(length(y.xy)-.25+.1*cos(x.z*8.+u4[0]*.1),length(y.yz)-.5),y=!3(q*(mod(w+x.z*.02,1.256636)-.628318),y.y+9.-q,mod(x.z,62.8318)-31.4159),o=step(u,z)+1.,z=min(u,z),u=length(y)-1.3;if(u0?a:\'\')+\'-stepTime*\'+a+\'/direction[t][6])*R(.875,.125)\')'), balls1CamFunc=f('a,b,c,d','c=desyncFunc(c),d=f(\'a,b,c,d\',\'vecSet(camPos,misc[2]=misc[8]=0,4,d=demoTime*3),vecSet(lookAt,a,0,d+b),vecSet(camUp,0,0,1),c()\')','function(){d(a,b,c)}'), balls2CamCommon=f('a','a=demoTime*5,vecSet(camPos,C(demoTime)*12,8,S(demoTime)*12+a),vecSet(lookAt,1,0,a),vecSet(camUp,0,1,0),toNearPlane=2.5,misc[8]=demoTime-direction[43][5]'), balls2LightFunc=f('a','','f(\'a\',\'vecSet(a[0],\'+a+\'*C(demoTime*2)*5,3,\'+a+\'*S(demoTime*2)*5+demoTime*30),a[1]=1,a[2]=4\')'), fract1CamCommon=f('','vecSet(camPos,4,2.5+.025*demoTime,6.7),vecSet(lookAt,misc[8]=misc[9]=0,2.5-.05*demoTime,6.7),vecSet(camUp,0,0,1),toNearPlane=3'), fract1CamFunc=f('a','a=desyncFunc(a)','function(){fract1CamCommon(),a()}'), fract2CamCommon=f('a,b','vecSet(camPos,5*S(b=demoTime*.2),9*C(demoTime*.41),7.8),vecSet(lookAt,C(b),S(demoTime*.33),camPos[2]-2),vecSet(camUp,0,0,misc[9]=1),misc[8]=a,toNearPlane=3'), drawText=f('a,b,c','with(twoDCtx)shadowBlur=c2height/5,fillText(a,b,c=c2height/2),shadowBlur=0,strokeText(a,b,c)'), titleParts=['TheT(ourist)','presents','Sine City'], titleText=f('a,b,c,d,e,f','drawText(titleParts[a],canvasWidth/15),misc[5]=1-c2rHeight+R(0,b),misc[6]=c,vecSet(textColour,d,e,f)'), greetingsText=f('','drawText(\'Greetings to ... Mog, Sycop, Tim & Wullon ... Adinpsz ... Alcatraz ... ASD ... Bits\\\'n\\\'Bites ... Brain Control ... Cocoon ... Conspiracy ... Ctrl+Alt+Test ... Fairlight ... Farbrausch ... Kewlers ... LNX ... Loonies ... Mercury ... Popsy Team ... Razor 1911 ... RGBA ... 7th Cube ... Still ... TPOLM ... TRBL ... Umlaut Design ... X-Men ... Youth Uprising ... Everyone here at DemoJS 2014!\',canvasWidth*(1-(demoTime-direction[34][5])/2)),misc[5]=1-c2rHeight+R(.01,.01),vecSet(textColour,misc[6]=1,1,1)'), squaresCam=f('a,b','a=demoTime-direction[25][5],vecSet(camPos,b=a*10-80,0,0),vecSet(lookAt,b+C(a*.5)*80,S(a*.25)*40,100),vecSet(camUp,0,toNearPlane=2.5,0)'), squaresCam2=f('a,b','a=demoTime-direction[a][5],vecSet(camPos,0,0,b=a*20-80),vecSet(lookAt,C(a*.5)*80,S(a*.25)*40,100+b),vecSet(camUp,0,1,0),misc[4]=R(a=.0125,a)'), tunnelLight=f('a','vecSub(a[0],camPos,vecNorm(a[0],lookAt)),a[0][1]-=.5,a[1]=3,a[2]=30'), tunnelCam=f('a','a=(demoTime-direction[a][5])*30*tunMul,vecSet(camPos,1.1*C(a*.1),S(a*.02),a),a+=5,vecSet(lookAt,-S(a*.05),-.7*C(a*.033),a),vecSet(camUp,0,toNearPlane=2,0)'), tunnelLightBall=f('a','','f(\'a,b\',\'b=demoTime-direction[\'+a+\'][5],vecSet(a[0],4*S(b*.5)*C(b*.7),3*C(b*1.5),b*30*tunMul+14+16*S(b*3.3)*C(b*.77)),a[1]=1,a[2]=2\')'), // direction 0<->rows / 1<->rm / 2<->setGlobals / 3<->lights / 4<->updateText / 5<->startTime / 6<->time / 7<->endTime direction = [ [ 36 , 0 , f('','tun1CamCommon(misc[2]=1-rStepTime*rStepTime*rStepTime,toNearPlane=5)') , a=[lightFunc(3,20)] ] , [ 18 , 0 , f('','tun1CamCommon(misc[2]=0,toNearPlane=5-2.25*rStepTime)') , a ] , [ 36 , 0 , f('','tun1CamCommon(misc[2]=rStepTime,toNearPlane=2.75-2.25*rStepTime)') , a ] , [ 18 , 3 , f('a','vecSet(camPos,0,4,a=demoTime*3),vecSet(lookAt,4,0,a),vecSet(camUp,0,0,1),misc[2]=1-rStepTime*rStepTime*rStepTime,toNearPlane=2.5') , [ lightFunc(.75,8) ] ] , [ 22 , 3 , balls1CamFunc(4,0,0) , a=[lightFunc(1,8)] ] , [ 22 , 3 , balls1CamFunc(2,-2,0) , a ] , [ 3 , 3 , balls1CamFunc( 6 , 0 , -.5 ) , b=[lightFunc(.5,4)] ] , [ 9 , 3 , balls1CamFunc( 6 , 0 , .5 ) , b ] , [ 3 , 3 , balls1CamFunc( 2 , 2 , -.2 ) , a ] , [ 9 , 3 , balls1CamFunc( 2 , 2 , .2 ) , a ] , [ 3 , 3 , balls1CamFunc( 2 , 5 , -.7 ) , a=[ lightFunc(1,2) ] ] , [ 7 , 3 , balls1CamFunc( 2 , 2 , .7 ) , a ] , [ 9 , 3 , f('a','vecSet(camPos,0,4+rStepTime*2,a=demoTime*3),vecSet(lookAt,2,0,a+2),vecSet(camUp,0,0,misc[3]=1),misc[2]=rStepTime') , a ] , [ 21 , 1 , f('','fract1CamCommon(misc[2]=1-rStepTime*rStepTime*rStepTime,misc[3]=1)'), a=[f('a','vecCopy(a[0],camPos),a[0][2]+=2,a[1]=1,a[2]=3')] ] , [ 14 , 1 , fract1CamFunc(0) , a ] , [ 3 , 1 , fract1CamFunc(-.4) , a ] , [ 9 , 1 , fract1CamFunc(.4) , a ] , [ 3 , 1 , fract1CamFunc(-.2) , a ] , [ 9 , 1 , fract1CamFunc(.2) , a ] , [ 12 , 1 , f('','fract1CamCommon(misc[4]=(-(6*rStepTime)%1)*R(.875,.125))'), a ] , [ 22 , 1 , f('','fract1CamCommon(misc[4]=((30*rStepTime)%1)*R(.925,.075),misc[2]=rStepTime,misc[3]=.4),toNearPlane=3-2.5*M(1,2*rStepTime)'), a ] , [ 3 , 1 , b=f('','fract1CamCommon(misc[4]=0,misc[2]=1)'), a ] , [ 12 , 1 , b , a, f('','titleText(0,.08,1,1,1,1)') ] , [ 12 , 1 , b , a, f('','titleText(0,.08,1-rStepTime,1,1,1)') ] , [ 12 , 1 , b , a, f('','titleText(1,.08,1-rStepTime,1,1,1)') ] , [ 20 , 2 , f('','squaresCam(misc[2]=1-rStepTime)') , b=[lightFunc(1,30)], f('','titleText(2,.04,rStepTime,1,1,1)') ] , [ 52 , 2 , f('','squaresCam(misc[2]=0)'), b, f('','titleText(2,.04,1,1,1,1)') ] , [ 12 , 2 , f('','squaresCam(misc[2]=1-M(0,rStepTime*2),misc[3]=1)'), b, f('','titleText(2,.04,1,1-rStepTime,1-rStepTime/2,1-rStepTime)') ] , [ 12 , 2 , f('a','squaresCam(misc[1]=1-rStepTime/2,misc[4]=(1-rStepTime)*.7+R(a=.0125,a))') , b, f('','titleText(2,.04,1,0,.5,0)') ] , [ 9 , 2 , f('','squaresCam2(29,misc[1]=(1-rStepTime)/2,misc[2]=1-M(0,rStepTime*1.5),misc[4]+=misc[1]*.6)'), b, f('','titleText(2,.04,1-rStepTime,0,.5,0)') ] , [ 69 , 2 , f('','squaresCam2(29,misc[1]=0)') , b ] , [ 11 , 2 , f('','squaresCam2(29,misc[2]=rStepTime,misc[3]=.2)'), b ] , [ 11 , 0 , f('','tunnelCam(32,misc[2]=1-rStepTime)'), b=[ tunnelLight ] ] , [ 17 , 0 , f('','tunnelCam(32,misc[2]=0,misc[4]=(1-rStepTime)*1.2*R(1,.02))') , b ] , [ 18 , 0 , f('','tunnelCam(32,misc[4]=0,misc[8]=rStepTime)') , b , greetingsText ] , [ 36 , 0 , f('','tunnelCam(32,misc[2]=1-N(misc[8]=1,4*rStepTime))'), b = [ tunnelLight , tunnelLightBall(32) ], greetingsText ] , [ 33 , 0 , f('','tunnelCam(32,misc[2]=rStepTime,misc[3]=.7,misc[4]=-((4*rStepTime)%1)*R(1,.05))'), b , greetingsText ] , [ 9 , 1 , f('','fract2CamCommon(misc[4]=0,misc[2]=rStepTime,misc[3]=1)'), a, greetingsText ] , [ 20 , 1 , f('','fract2CamCommon(rStepTime,misc[2]=0)'), a, greetingsText ] , [ 31 , 1 , f('','fract2CamCommon(1,misc[2]=1-N(1,5*rStepTime))'), a, greetingsText ] , [ 5 , 1 , f('','fract2CamCommon(1,misc[2]=1-rStepTime)'), a, greetingsText ] , [ 18 , 1 , f('','fract2CamCommon(1,misc[2]=1-N(1,5*rStepTime),misc[4]=M(0,1.6*rStepTime-.8)*R(1,.05))'), a, greetingsText ] , [ 12 , 1 , f('','fract2CamCommon(1,misc[2]=rStepTime,misc[4]=(1-rStepTime)*.8*R(1,.05),misc[3]=.1)'), a, greetingsText ] , [ 22 , 3 , f('','balls2CamCommon(misc[2]=1-rStepTime,misc[4]=0)'), a = [ lightFunc(.6,30) , balls2LightFunc(1),balls2LightFunc(-1) ], greetingsText ] , [ 59 , 3 , f('','balls2CamCommon(misc[2]=1-N(1,(12*rStepTime)%4),misc[3]=.8)'), a, greetingsText ] , [ 8 , 3 , f('','balls2CamCommon(misc[2]=rStepTime,misc[4]=R(0,misc[3]=.1))'), a ] , [ 7 , 0 , f('','misc[tunMul=2]=1-rStepTime,tunnelCam(46,misc[4]=R(0,.1),misc[8]=1)'), a = [ tunnelLight , tunnelLightBall(46) ] ] , [ 22 , 0 , f('','tunnelCam(46,misc[4]=R(0,.1))'), a ] , [ 10 , 0 , f('','tunnelCam(46,misc[4]=R(0,.1+rStepTime*.4)+stepTime*4,misc[2]=rStepTime,misc[3]=1)'), a ] , [ 10 , 2 , f('','squaresCam2(49,misc[2]=1-rStepTime),misc[4]=R(0,.5)+(demoTime-direction[48][5])*4'), a=[ lightFunc(1,30) ] ] , [ 40 , 2 , f('','squaresCam2(49),misc[4]=R(0,.5)-(demoTime-direction[48][5])*6'), a ] , [ 40 , 2 , f('','squaresCam2(49),misc[4]=R(misc[3]=0,.5)+(demoTime-direction[48][5])*8,misc[2]=rStepTime'), a ] , [ 68 , 2 , f('','squaresCam2(49,misc[2]=1)'), a ] ]; cmU=vomNew(3), cmV=vomNew(3), cmW=vomNew(3), cd=vomNew(3), cu=vomNew(3), cm=vomNew(9); // Main with(document.body)style.background='black',innerHTML='