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 :)
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.
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.
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.
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.
41 comments
[ 2.4 ms ] story [ 94.2 ms ] threadhttps://tixy.land/?code=Math.cos(x*t-i)/Math.cos(y*i-t)
https://tixy.land/?code=Math.cos(x/t)-Math.cos(y/t)
https://tixy.land/?code=Math.cos((x/t)/y-t)
https://tixy.land/?code=Math.sin%28y%2Bt*2%29-Math.cos%28x-t...
https://tixy.land/?code=Math.sin%28Math.atan%28%28y%29%2F%28...
https://tixy.land/?code=Math.log%28Math.sin%28t%29*5%2Bx%2Fy...
Edit: I don't even know what's happening in this one https://tixy.land/?code=Math.sin%28i%26t%29*%28Math.clz32%28...
(looks like it auto-adds `Math.` for you now)
[0] https://24a2.routley.io/
[1] https://news.ycombinator.com/item?id=23664814
Trying to guess what a function will look like without looking at the dots is fun.
https://tixy.land/?code=Math.sin%283*t-%28x%2F6%29**2-%28y%2...
https://tixy.land/?code=Math.sin%280.2*i%257%2Bt%29
https://tixy.land/?code=i%2F256
https://tixy.land/?code=x%21%3D5+%26%26+y+%21%3D+7
https://tixy.land/?code=x%2F32%2By%2F32
https://tixy.land/?code=Math.sin%28t%29
https://tixy.land/?code=Math.sin%28t%2Bx%29
https://tixy.land/?code=Math.sin%28t%2By%29
https://tixy.land/?code=Math.sin%28t%2Bi%29
https://tixy.land/?code=i%26x%26%28y*Math.sin%28t%29%29
You can have lots of fun mixing the bitwise ops with trig functions!
The Matrix: https://tixy.land/?code=i%2F%28x*y%29*%28t*i%29*Math.sin%28t...
Matrix Reloaded: https://tixy.land/?code=i%2F%28x%2Fy%29*%28t%2Fi%29*Math.sin...
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.
https://www.dwitter.net
Reminds me of bytebeats, dwitter, etc. http://canonical.org/%7Ekragen/bytebeat/ https://www.dwitter.net/
https://tixy.land/?code=Math.sin%28t*x*%28i%2F256%29%29
https://tixy.land/?code=Math.sin%28i%2Bt%29*Math.cos%28t%2F2...
https://tixy.land/?code=Math.sin%28i%2Bt%29*Math.cos%28t%2F2...
Not as good as some here, but here is an animated sinus function: https://tixy.land/?code=y%3D%3D%7E%7E%288-7*Math.sin%28t*5%2...
Tip: Writing ~~ is much more space efficient than Math.floor
https://tixy.land/?code=1-t%252%2B%28x-8%29*%28y-8%29%25%7E%...
https://tixy.land/?code=1-t%252-%28%28x-9%29%5E%28y-9%29%29%...
[1]: https://twitter.com/mattdesl/status/1323622421933576192
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...
I am flummoxed by all these code examples - they produce so much with so little. Any theory behind these cryptic sin and cos 1 liners?
// skip `Math.` to use methods
// and props like `sin` or `PI`