Skip to content

Instantly share code, notes, and snippets.

@p01
Last active March 25, 2016 22:45
Show Gist options
  • Save p01/2bac941529aef959e8c9 to your computer and use it in GitHub Desktop.
Save p01/2bac941529aef959e8c9 to your computer and use it in GitHub Desktop.

Revisions

  1. p01 revised this gist Mar 25, 2016. 2 changed files with 3 additions and 3 deletions.
    4 changes: 2 additions & 2 deletions demo_2.js
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    // Compresses to 905 bytes ;)
    b.bgColor="#36f",A=new AudioContext,C=A.createScriptProcessor(a.width=1024,s=0,1),C.connect(A.destination),C.onaudioprocess=function(b){for(b=b.outputBuffer.getChannelData(d=0),a.height=420,c.fillStyle="#9cf",c.font="116px serif",c.fillText("\u2601",7*s%1336-226,226),c.font="226px serif",c.fillText("\u2601",9*s%1336-226,226),c.font="66px serif",c.fillText("\u2601",4*s%1336-226,226),c.fillText("\u2601",6*s%1336-226,226),c.fillStyle="#003",c.fillRect(0,336,1024,336);d<1024;s+=6.25/A.sampleRate)c.fillRect(0,336-d,1024,d/336),c.fillRect(d,336+(b[d++]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(d&1)*264],36)+9)&1)-.5),4,226*Math.sin(d/116)+16*Math.sin(d/16));c.fillStyle="#f6f",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
    // Compresses to 900 bytes ;)
    b.bgColor="#36f",A=new AudioContext,C=A.createScriptProcessor(a.width=1024,s=0,1),C.connect(A.destination),C.onaudioprocess=function(b){for(a.height=480,b=b.outputBuffer.getChannelData(d=0),c.fillStyle="#9cf",c.font="116px serif",c.fillText("\u2601",7*s%1336-226,226),c.font="226px serif",c.fillText("\u2601",9*s%1336-226,226),c.font="66px serif",c.fillText("\u2601",4*s%1336-226,226),c.fillText("\u2601",6*s%1336-226,226),c.fillStyle="#003";d<1024;s+=6.25/A.sampleRate)c.fillRect(0,d,1024,d<336?1-d/336:1),c.fillRect(d,336+(b[d++]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(d&1)*264],36)+9)&1)-.5),4,226*Math.sin(d/116)+16*Math.sin(d/16));c.fillStyle="#f6f",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Looking at the repository of @homecoded's cool entry for [JS1k 2016: THE SECRET TO MENTAL ISLAND](https://github.com/homecoded/demo/tree/master/HC04-secret-of-mental-island-by-homecoded) in 1024 bytes, I spotted a few bits of code that could be optimized so I did that.

    The current size is 905 bytes with title and animated fluffy clouds.
    The current size is 900 bytes with title and animated fluffy clouds.

    Enjoy
  2. p01 revised this gist Mar 25, 2016. 2 changed files with 3 additions and 3 deletions.
    4 changes: 2 additions & 2 deletions demo_2.js
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    // Compresses to 908 bytes ;)
    b.bgColor="#36f",A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(b){for(b=b.outputBuffer.getChannelData(d=0),a.height=420,c.fillStyle="#9cf",c.font="116px serif",c.fillText("\u2601",7*s%1336-226,226),c.font="226px serif",c.fillText("\u2601",9*s%1336-226,226),c.font="66px serif",c.fillText("\u2601",4*s%1336-226,226),c.fillText("\u2601",6*s%1336-226,226),c.fillStyle="#003",c.fillRect(0,336,1024,336);d<1024;s+=6.25/A.sampleRate)c.fillRect(0,336-d,1024,d/336),c.fillRect(d,336+(b[d++]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(d&1)*264],36)+9)&1)-.5),4,277*Math.sin(d/116)+16*Math.sin(d/16));c.fillStyle="#f6f",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
    // Compresses to 905 bytes ;)
    b.bgColor="#36f",A=new AudioContext,C=A.createScriptProcessor(a.width=1024,s=0,1),C.connect(A.destination),C.onaudioprocess=function(b){for(b=b.outputBuffer.getChannelData(d=0),a.height=420,c.fillStyle="#9cf",c.font="116px serif",c.fillText("\u2601",7*s%1336-226,226),c.font="226px serif",c.fillText("\u2601",9*s%1336-226,226),c.font="66px serif",c.fillText("\u2601",4*s%1336-226,226),c.fillText("\u2601",6*s%1336-226,226),c.fillStyle="#003",c.fillRect(0,336,1024,336);d<1024;s+=6.25/A.sampleRate)c.fillRect(0,336-d,1024,d/336),c.fillRect(d,336+(b[d++]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(d&1)*264],36)+9)&1)-.5),4,226*Math.sin(d/116)+16*Math.sin(d/16));c.fillStyle="#f6f",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Looking at the repository of @homecoded's cool entry for [JS1k 2016: THE SECRET TO MENTAL ISLAND](https://github.com/homecoded/demo/tree/master/HC04-secret-of-mental-island-by-homecoded) in 1024 bytes, I spotted a few bits of code that could be optimized so I did that.

    The current size is 908 bytes with title and animated fluffy clouds.
    The current size is 905 bytes with title and animated fluffy clouds.

    Enjoy
  3. p01 revised this gist Mar 25, 2016. 2 changed files with 3 additions and 3 deletions.
    4 changes: 2 additions & 2 deletions demo_2.js
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    // Compresses to 910 bytes ;)
    b.bgColor="#36f";A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(x=0),a.height=420,c.fillStyle="#9cf",c.font="116px serif",c.fillText("\u2601",7*s%1500-336,226),c.font="226px serif",c.fillText("\u2601",9*s%1500-336,226),c.font="66px serif",c.fillText("\u2601",4*s%1500-336,226),c.fillText("\u2601",6*s%1500-336,226),c.fillStyle="#003",c.fillRect(0,336,1024,336);x<1024;s+=6.25/A.sampleRate)c.fillRect(0,336-x,1024,x/336),c.fillRect(x,336+(b[x++]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(x&1)*264],36)+9)&1)-.5),4,277*Math.sin(x/116)+16*Math.sin(x/16));c.fillStyle="#f6f",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
    // Compresses to 908 bytes ;)
    b.bgColor="#36f",A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(b){for(b=b.outputBuffer.getChannelData(d=0),a.height=420,c.fillStyle="#9cf",c.font="116px serif",c.fillText("\u2601",7*s%1336-226,226),c.font="226px serif",c.fillText("\u2601",9*s%1336-226,226),c.font="66px serif",c.fillText("\u2601",4*s%1336-226,226),c.fillText("\u2601",6*s%1336-226,226),c.fillStyle="#003",c.fillRect(0,336,1024,336);d<1024;s+=6.25/A.sampleRate)c.fillRect(0,336-d,1024,d/336),c.fillRect(d,336+(b[d++]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(d&1)*264],36)+9)&1)-.5),4,277*Math.sin(d/116)+16*Math.sin(d/16));c.fillStyle="#f6f",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Looking at the repository of @homecoded's cool entry for [JS1k 2016: THE SECRET TO MENTAL ISLAND](https://github.com/homecoded/demo/tree/master/HC04-secret-of-mental-island-by-homecoded) in 1024 bytes, I spotted a few bits of code that could be optimized so I did that.

    The current size is 910 bytes with title and animated fluffy clouds.
    The current size is 908 bytes with title and animated fluffy clouds.

    Enjoy
  4. p01 revised this gist Mar 24, 2016. 2 changed files with 5 additions and 3 deletions.
    4 changes: 2 additions & 2 deletions demo_2.js
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    // Compresses to 917 bytes ;)
    b.bgColor="#46f";A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(x=0),a.height=366,c.fillStyle="#9bf",c.font="116px serif",c.fillText("\u2601",7*s%1500-336,226),c.font="226px serif",c.fillText("\u2601",9*s%1500-336,226),c.font="66px serif",c.fillText("\u2601",4*s%1500-336,226),c.fillText("\u2601",6*s%1500-336,226),c.fillStyle="#012";x<1024;x++,s+=6.25/A.sampleRate)c.fillRect(0,336-x,1024,x/336),c.fillRect(x,336+277*Math.sin(x/116)+4*Math.sin(x/16),2,366),b[x]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(x&1)*264],36)+9)&1)-.5,c.fillRect(x,336+b[x],2,366);c.fillStyle="#b4b",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
    // Compresses to 910 bytes ;)
    b.bgColor="#36f";A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(x=0),a.height=420,c.fillStyle="#9cf",c.font="116px serif",c.fillText("\u2601",7*s%1500-336,226),c.font="226px serif",c.fillText("\u2601",9*s%1500-336,226),c.font="66px serif",c.fillText("\u2601",4*s%1500-336,226),c.fillText("\u2601",6*s%1500-336,226),c.fillStyle="#003",c.fillRect(0,336,1024,336);x<1024;s+=6.25/A.sampleRate)c.fillRect(0,336-x,1024,x/336),c.fillRect(x,336+(b[x++]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(x&1)*264],36)+9)&1)-.5),4,277*Math.sin(x/116)+16*Math.sin(x/16));c.fillStyle="#f6f",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
    4 changes: 3 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    Looking at the repository of @homecoded's cool entry for [JS1k 2016: THE SECRET TO MENTAL ISLAND](https://github.com/homecoded/demo/tree/master/HC04-secret-of-mental-island-by-homecoded), I spotted a few bits of code that could be optimized so I did that.
    Looking at the repository of @homecoded's cool entry for [JS1k 2016: THE SECRET TO MENTAL ISLAND](https://github.com/homecoded/demo/tree/master/HC04-secret-of-mental-island-by-homecoded) in 1024 bytes, I spotted a few bits of code that could be optimized so I did that.

    The current size is 910 bytes with title and animated fluffy clouds.

    Enjoy
  5. p01 revised this gist Mar 24, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions demo_2.js
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    // Compresses to 932 bytes ;)
    b.bgColor="#46f";A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(x=0),a.height=366,c.fillStyle="#46f",c.fillRect(0,0,1024,366),c.fillStyle="#9bf",c.font="116px serif",c.fillText("\u2601",7*s%1400-300,226),c.font="226px serif",c.fillText("\u2601",9*s%1400-300,226),c.font="66px serif",c.fillText("\u2601",4*s%1400-300,226),c.fillText("\u2601",6*s%1400-300,226),c.fillStyle="#012";x<1024;x++,s+=6.25/A.sampleRate)c.fillRect(0,330-x,1024,x/336),c.fillRect(x,330+277*Math.sin(x/116)+4*Math.sin(x/16),2,366),b[x]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(x&1)*264],36)+9)&1)-.5,c.fillRect(x,330+b[x],2,366);c.fillStyle="#b4b",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
    // Compresses to 917 bytes ;)
    b.bgColor="#46f";A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(x=0),a.height=366,c.fillStyle="#9bf",c.font="116px serif",c.fillText("\u2601",7*s%1500-336,226),c.font="226px serif",c.fillText("\u2601",9*s%1500-336,226),c.font="66px serif",c.fillText("\u2601",4*s%1500-336,226),c.fillText("\u2601",6*s%1500-336,226),c.fillStyle="#012";x<1024;x++,s+=6.25/A.sampleRate)c.fillRect(0,336-x,1024,x/336),c.fillRect(x,336+277*Math.sin(x/116)+4*Math.sin(x/16),2,366),b[x]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(x&1)*264],36)+9)&1)-.5,c.fillRect(x,336+b[x],2,366);c.fillStyle="#b4b",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
  6. p01 revised this gist Mar 24, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions demo_2.js
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    // Compresses to 937 bytes ;)
    b.bgColor='#46f';A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(x=0),a.height=360,c.fillStyle="#9bf",c.font="62px serif",c.fillText("\u2601",4*s%1400-300,220),c.fillText("\u2601",6*s%1400-300,220),c.font="110px serif",c.fillText("\u2601",7*s%1400-300,220),c.font="220px serif",c.fillText("\u2601",9*s%1400-300,220),c.fillStyle="#002";x<1024;x++,s+=6.25/A.sampleRate)c.fillRect(0,330-x,1024,x/330),c.fillRect(x,330+277*Math.sin(x/117)+4*Math.sin(x/11),1,360),b[x]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(x&1)*264],36)+9)&1)-.5,c.fillRect(x,330+b[x],2,360);c.fillStyle="#b4b",c.font="16px serif",c.fillText("THE SECRET OF",480,96),c.font="62px serif",c.fillText("MENTAL",420,150),c.fillText("ISLAND",480,196)}
    // Compresses to 932 bytes ;)
    b.bgColor="#46f";A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(x=0),a.height=366,c.fillStyle="#46f",c.fillRect(0,0,1024,366),c.fillStyle="#9bf",c.font="116px serif",c.fillText("\u2601",7*s%1400-300,226),c.font="226px serif",c.fillText("\u2601",9*s%1400-300,226),c.font="66px serif",c.fillText("\u2601",4*s%1400-300,226),c.fillText("\u2601",6*s%1400-300,226),c.fillStyle="#012";x<1024;x++,s+=6.25/A.sampleRate)c.fillRect(0,330-x,1024,x/336),c.fillRect(x,330+277*Math.sin(x/116)+4*Math.sin(x/16),2,366),b[x]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(x&1)*264],36)+9)&1)-.5,c.fillRect(x,330+b[x],2,366);c.fillStyle="#b4b",c.fillText("MENTAL",420,146),c.fillText("ISLAND",480,196),c.font="16px serif",c.fillText("THE SECRET OF",480,96)}
  7. p01 revised this gist Mar 24, 2016. 2 changed files with 3 additions and 3 deletions.
    4 changes: 2 additions & 2 deletions demo_2.js
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    // Compresses to 928 bytes ;)
    A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(0),a.height=360,c.fillStyle="#46f",c.fillRect(0,0,1024,360),c.font="62px serif",c.fillText("\u2601",4*s%1400-300,220),c.fillText("\u2601",6*s%1400-300,220),c.font="110px serif",c.fillText("\u2601",7*s%1400-300,220),c.font="220px serif",c.fillText("\u2601",9*s%1400-300,220),c.fillStyle="#002",x=0;x<1024;x++,s+=6.25/A.sampleRate)c.fillRect(0,330-x,1024,x/330),c.fillRect(x,330+277*Math.sin(x/117)+4*Math.sin(x/11),1,360),b[x]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegcc"[0|s%264],36)+9)&1)+(55*s*Math.pow(1.059463,parseInt("bbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264],36))&1)-1,c.fillRect(x,330+b[x],1,360);c.fillStyle="#B4B",c.font="16px serif",c.fillText("THE SECRET OF",480,98),c.font="62px serif",c.fillText("MENTAL",420,150),c.fillText("ISLAND",480,196)}
    // Compresses to 937 bytes ;)
    b.bgColor='#46f';A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(x=0),a.height=360,c.fillStyle="#9bf",c.font="62px serif",c.fillText("\u2601",4*s%1400-300,220),c.fillText("\u2601",6*s%1400-300,220),c.font="110px serif",c.fillText("\u2601",7*s%1400-300,220),c.font="220px serif",c.fillText("\u2601",9*s%1400-300,220),c.fillStyle="#002";x<1024;x++,s+=6.25/A.sampleRate)c.fillRect(0,330-x,1024,x/330),c.fillRect(x,330+277*Math.sin(x/117)+4*Math.sin(x/11),1,360),b[x]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegccbbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264+(x&1)*264],36)+9)&1)-.5,c.fillRect(x,330+b[x],2,360);c.fillStyle="#b4b",c.font="16px serif",c.fillText("THE SECRET OF",480,96),c.font="62px serif",c.fillText("MENTAL",420,150),c.fillText("ISLAND",480,196)}
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    <!doctype html><body><canvas id="a"></canvas><script> window.c = a.getContext('2d'); </script><script src="demo_2.js"></script></body>
    <!doctype html><style>body,canvas{display:block;margin:0;}</style></style><body id="b"><canvas id="a"></canvas><script> window.c = a.getContext('2d'); </script><script src="demo_2.js"></script></body>
  8. p01 revised this gist Mar 23, 2016. 2 changed files with 3 additions and 1 deletion.
    2 changes: 2 additions & 0 deletions demo_2.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    // Compresses to 928 bytes ;)
    A=new AudioContext,C=A.createScriptProcessor(a.width=1024,1,1),s=0,C.connect(A.destination),C.onaudioprocess=function(l){for(b=l.outputBuffer.getChannelData(0),a.height=360,c.fillStyle="#46f",c.fillRect(0,0,1024,360),c.font="62px serif",c.fillText("\u2601",4*s%1400-300,220),c.fillText("\u2601",6*s%1400-300,220),c.font="110px serif",c.fillText("\u2601",7*s%1400-300,220),c.font="220px serif",c.fillText("\u2601",9*s%1400-300,220),c.fillStyle="#002",x=0;x<1024;x++,s+=6.25/A.sampleRate)c.fillRect(0,330-x,1024,x/330),c.fillRect(x,330+277*Math.sin(x/117)+4*Math.sin(x/11),1,360),b[x]=(55*s*Math.pow(1.059463,parseInt(" qqqtsqooqqqqqqooomlommmmllllllqqqqqtsqooqqqqqqqsttttvvvvssstsqosttttssssqqqtsqosttttssssqqqtsqooqqqqqqqqqqqqomlommmmllllllllllllllllllllllllllooqqhhhhhhmljmoohhhhhhllhhmmooooovovtvttssqqllllllgghhrrrrrrrrrrrrrrrrxxttttttssttstqtttmmmmmmmmmmmmmmjjggggggeeggegcc"[0|s%264],36)+9)&1)+(55*s*Math.pow(1.059463,parseInt("bbnqbbnn99lljjvzeeqqeellggggsnnzbbnnbbnn99lljjvzeeqqeeqqggggllxxlllleeqqaamybbnn99lleeii66iibbnq99lo77jn77jj77jneeqqggssnnnnbbnqeennllllbbnueenn99lpjjjjjjjjjjjjjjeeiillllll77lu11449999bbbb6622222222bbccggjjjjjjjjjjoonniieeeeeeeeeeebeeiillllllllllqqppllggggggggggll"[0|s%264],36))&1)-1,c.fillRect(x,330+b[x],1,360);c.fillStyle="#B4B",c.font="16px serif",c.fillText("THE SECRET OF",480,98),c.font="62px serif",c.fillText("MENTAL",420,150),c.fillText("ISLAND",480,196)}
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    <!doctype html><body><canvas id="a"></canvas><script> window.c = a.getContext('2d'); </script><script src="demo.js"></script></body>
    <!doctype html><body><canvas id="a"></canvas><script> window.c = a.getContext('2d'); </script><script src="demo_2.js"></script></body>
  9. p01 revised this gist Mar 21, 2016. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    Looking at the repository of @homecoded's cool entry for [JS1k 2016: THE SECRET TO MENTAL ISLAND](https://github.com/homecoded/demo/tree/master/HC04-secret-of-mental-island-by-homecoded), I spotted a few bit of code that could be optimized so I did that.
    Looking at the repository of @homecoded's cool entry for [JS1k 2016: THE SECRET TO MENTAL ISLAND](https://github.com/homecoded/demo/tree/master/HC04-secret-of-mental-island-by-homecoded), I spotted a few bits of code that could be optimized so I did that.

    Enjoy

  10. p01 revised this gist Mar 21, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    <!doctype html><body><canvas id="a"></canvas><script> window.c = a.getContext('2d'); </script><script src="p01.js"></script></body>
    <!doctype html><body><canvas id="a"></canvas><script> window.c = a.getContext('2d'); </script><script src="demo.js"></script></body>
  11. p01 revised this gist Mar 21, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    <!doctype html><canvas id="a"></canvas><script src="demo.js"></script>
    <!doctype html><body><canvas id="a"></canvas><script> window.c = a.getContext('2d'); </script><script src="p01.js"></script></body>
  12. p01 revised this gist Mar 21, 2016. 2 changed files with 1 addition and 1 deletion.
    1 change: 0 additions & 1 deletion index.htm
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    <canvas id="a"></canvas><script src="demo.js"></script>
    1 change: 1 addition & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <!doctype html><canvas id="a"></canvas><script src="demo.js"></script>
  13. p01 created this gist Mar 21, 2016.
    1 change: 1 addition & 0 deletions demo.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    for(_='024z),v33$22:atQon!,4GddKKKJ99@@bbJK?rocess>ect(`qq_kk^0,Z37YllX^^^WmlkmXXWVhhU5511mm☁",ff77rrrqomq__(n[parseInt("c.fiX,Text("Z:0)cc*MQh.sin(x/,1,c.globalAlpha=,R`Zxz,aaoo ii Klo@ @ Style="#K"[0|s%264],35)]*s&1) orqo ,c.f!t="pppppx serif"x+=Y)n=[35,YG1G6G9,,58,62,65,73,82,93,98101723313947658596,:Z2$,247,262,2,294,$ZY0],A=new AudioC!text,C=A.creQeScriptP>or(a.width=1zvs=ZC.c!n`A.destinQi!vC.!audiop>=functi!(l){for(b=l.outputBuer.getChannelDQa(x=0va.height=YZ214"Y0v46f".1162:740Y:054,002",x=0;x<1z;x++,s+=6.25/A.sampleRQe)R`x,$0+MQh.min(27)+4vb[x]=JV oqssss_q o VWWW^ lkjl ^ Xmsmsrs_ WU tt_qrorXXXXXXXjjUUUUfh+fi Kjo KJ@ 66enK@bb$bbfidg44cf4444cf@ jjfi@Jfk@dh?44dk00:$88ggbb@@@@@97?J UK-1),Y0);B4B"16THE SECRET OF"G8Z98)62MENTAL"G2050)ISLAND"G8096)}';G=/[-U-Z^-`>-@JKG!Q:$vz]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
    1 change: 1 addition & 0 deletions index.htm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <canvas id="a"></canvas><script src="demo.js"></script>
    4 changes: 4 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    Looking at the repository of @homecoded's cool entry for [JS1k 2016: THE SECRET TO MENTAL ISLAND](https://github.com/homecoded/demo/tree/master/HC04-secret-of-mental-island-by-homecoded), I spotted a few bit of code that could be optimized so I did that.

    Enjoy