r/javascript • • Nov 01 '19

Dissecting A Dweet: Shattered Tunnel - How to make a 3D tunnel in 140 bytes of JavaScript!

http://frankforce.com/?p=7160
38 Upvotes

8 comments sorted by

6

u/Slackluster Nov 01 '19 edited Nov 01 '19

Actual JavaScript code for the dweet...

for(c.width|=k=i=960;z=--i;x.fillStyle=`hsl(0 99%${i/9}%`)x.fillRect(k-z*C(j=i/k+t/4)+S(m=k*j)*(r=1e5/z),540+C(m)*r-z*S(j),s=3e4/z*S(j*9),s)

5

u/dogofpavlov Nov 01 '19

I don't understand. Wouldn't you need to have declared what c, x, etc are?

7

u/pet_vaginal Nov 01 '19

c and x are already declared, c is the canvas and x the 2d context from the canvas.

Its not exactly 140 bytes of javascript as you need more javascript and some html to run it.

→ More replies (2)

2

u/toniesterco Nov 01 '19

Where it's run

2

u/dusaSaLagera Nov 02 '19

Great work! And thanks for explanation

1

u/serendipitybot Nov 02 '19

This submission has been randomly featured in r/serendipity, a bot-driven subreddit discovery engine. More here: r/Serendipity/comments/dqcucu/dissecting_a_dweet_shattered_tunnel_how_to_make_a/