I just got a new office, and was thinking, "What can I decorate this place with? What inspires me most? What conveys the beauty of code most aptly?"
"What would be really cheap to make, yet leverages a lot of other people's cleverness?"
The Dweet Gallery was born.
- Work in progress (of course)
- The default HTML file runs the top 1000 dweets by 'awesome count' on a 10 minute timer, then randomly selects another
- Suggestions for improvement / pull requests for actual improvement welcome
- Trivia: the popularity of dweets on dwitter.net follows a power law
Raspberry Pi + Old Monitor + displaying the .html file in this repo = something way better than some boring, static pictures on your wall
The fine people over at Dwitter.net made all the dweets. Check out dwitter.net
GET www.dwitter.net/api/dweets/ - list of the last 10 dweets
?limit=100 - number of results to return, default 10, max 100 (subject to change)
&offset=200 - offset page by 200 dweets
&remix_of=123 - all remixes of 123
&author=lionleaf - dweets by author
curl "https://www.dwitter.net/api/dweets/?limit=1"
u(t) is called 60 times per second.
t: Elapsed time in seconds.
S: Shorthand for Math.sin.
C: Shorthand for Math.cos.
T: Shorthand for Math.tan.
R: Function that generates rgba-strings, usage ex.: R(255, 255, 255, 0.5)
c: A 1920x1080 canvas.
x: A 2D context for that canvas.
- this stuff is the same every time, and the pulled dweet goes after the 'for':
function u(t) { for
}
- this works by converting the string to base64, then you throw that into the url after the t/
Just run the .html file in your browser
c.width = 1920;
c.height = 1080;
S = Math.sin;
C = Math.cos;
T = Math.tan;
R = function(r,g,b,a) {
a = a === undefined ? 1 : a;
return "rgba("+(r|0)+","+(g|0)+","+(b|0)+","+a+")";
};
x = c.getContext("2d");
frame = 0;
function loop() {
u(frame++ / 60);
requestAnimationFrame(loop);
};
function u(t) {c.width|=0
for(i=2e3;i--;x.fillRect(700+i/4+S(i)*99,540+S(t)*400+C(i)*99,19,19))x.fillStyle=hsl(${i&896},50%,${S(i-S(t))**6*255}%)
}
loop();
- You might have more luck with a bunch of gif recordings of the dweets, which is actually a feature of dwitter.net
- However, GIF recording is very intensive on the site and actually caused my computer to crash in Firefox, and the feature doesn't really seem to work in Chrome either (for me). So I went with this.
- \r\n replace all with ;
- The rest of my little fixes to the API call results are in 'json_pull_fix.py