I can haz teh haxx0rz? Working around the character limit.
I stored an expression in the URL fragment/hash, loaded it from there and eval-ed it. The hash symbol would break the expression, so it needs to be removed or commented out. Removing it by string manipulation would have exceeded the 32 character limit, so I went with commenting it out. That means you need to start any expression with "* /" (remove the space) to close the comment around the hash symbol.
The hover text of the example link gives you a good idea of what is happening.
I discovered only now that the snippet is evaluated with(Math){ }. Therefore you can omit Math. on calls to methods of it and have five more extra characters at your disposal. Strange that they did not mention this in the tutorial. It seems rather important as the budget is super-limited.
Reminds me of writing full-screen fragment shaders, where you'd just get a screen position and time and construct some cool things. This one's much smaller and easier to reason about though, very cool :)
This is really sweet, I love stuff like this. I do have a suggestion though, which is to create some aliases for the most commonly used Standard Library functions, such as Math.sin into s, or Math.cos into c, etc. This would save some space and allow slightly more code to be entered and more complex effects to be achieved.
Would you know of any resources to build a little led circuit like that on a breadborad, with standard components, that could be powered by a Pi?
In smaller dimensions of course, but even 4*4 would be interesting for educational purposes. The things I found online all used pre-built led boards which is less interesting I think.
A MAX7219 is an LED driver that can power an 8x8 grid of LEDs, so you could do the full 16x16 with 4 of these, or shrink down to 8x8 with just one. Then it's just a case of wiring up the LED matrix and connecting the MAX7219 to the Pi.
You write the body of the function that takes t, i, x, and y as inputs for each dot. A return value of 1 or "1" or true and it shows a large white dot. A return value of 0 or false, and it shows nothing. A return value of -1 or "-1" and it shows a large red dot. Positive fractions is a smaller white dot, negative fractions is a smaller red dot.
I stored an expression in the URL fragment/hash, loaded it from there and eval-ed it. The hash symbol would break the expression, so it needs to be removed or commented out. Removing it by string manipulation would have exceeded the 32 character limit, so I went with commenting it out. That means you need to start any expression with "* /" (remove the space) to close the comment around the hash symbol.
The hover text of the example link gives you a good idea of what is happening.
Have fun!
Random animation, 47 characters payload:
https://tixy.land/?code=eval(%27%2F*%27%2Bparent.location.ha...