dweet unpacker
ok this one might require a bit of explanation.
i absolutely love dwitter, a site where you can code golf some beautiful javascript visualisations with 140 characters. except i absolutely hate code golf :( so here's a little dweet unpacker to try and create some more usable dweets
paste a dweet, unpack it, then mess around with the readable version. you can run either one and compare. ctrl + enter runs whichever editor you're in.
c = canvas, x = 2d context, t = seconds. S / C / T = sin / cos / tan. R makes rgba colours; use Math.random() for randomness. the output expects a canvas with id="canvas".
what gets unpacked?
the short canvas, time, colour and maths names get expanded, and the code gets spaced out and indented. strings, comments, regular expressions and template text are left alone. if local scopes or dynamic code make a rename uncertain, the aliases stay, with their definitions in the setup.
this doesn't invent meaningful names for a, b and whatever else someone squeezed into 140 characters, or turn every code-golf trick into sensible control flow. it keeps the original operations.
the preview runs canvas-only code in an isolated worker, so stop still works if a loop gets stuck. DOM tricks aren't supported in the preview. pause freezes the clock; step advances it by 1/60 second. the two editors are saved in this browser when storage is available.