
See what you can create with 140 characters of JavaScript and a canvas - pajtai
https://www.dwitter.net/
======
twiceaday
These all assume certain variables are pre-defined but nowhere does it say
what they are.

Edit: If you hit "New dweet" it tells you.

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.

~~~
tokyodude
I've always wished they'd have totally embraced their shortcuts and added as
many as possible.

they could shorten every setter and function so c.width could just be w() or
c.w= and c.fillStyle could just be fs(style) or c.fs=

They arbitrary shorten somethings but not others seems well... arbitrary

~~~
gregschlom
You know, the 140 chars limit or even the fact that there should be a limit at
all is arbitrary too :)

------
dsamarin
Well, I have done just about all I can to do to make the Matrix digital rain,
but I am sadly 100 bytes over. I am out of time to kill, but if you aren't,
please take this off of my hands. :)

    
    
      with(x)for(fillStyle="#000",fillRect(0,0,1e4,1e4),font="32px m",i=0;1920>i;i+=32)for(j=0,a=((2166136261*i^16777619)+960*t)%2160;b=255*(32>a-j),1080>j&&j<a;j+=42)fillStyle=R(b,765+j-a+b,b,1),fillText(String.fromCharCode((i+j)%85+12353),i,j);

~~~
Forge36
174 it feels close. I dropped the text and went with numbers. (sorry for any
duplicate notification spam)

    
    
       with(x)for(fillStyle="#000",font="2em m",fillRect(i=0,o=32,n=1920,n);n>i;i+=o)for(j=0,a=((2e7*i^1e9)+n*t)%n;n>j&&j<a;j+=o)fillStyle=R(b=n*(o>a-j),n/2+j-a,b),fillText(j%9,i,j)

~~~
Forge36
145

    
    
       for(x.fillRect(i=0,0,n=c.width=540,n);n>i;i+=o)for(o=12,j=0,a=((n*i^1e7)+n*t)%n;j<a;j+=o)x.fillStyle=R(b=n*(o>a-j),n/2+j-a,b),x.fillText(j%9,i,j)

~~~
Forge36
140 :)

[https://www.dwitter.net/d/10398](https://www.dwitter.net/d/10398)

------
tomxor
This is great, I've been tempted by js1k a number of times but the concept of
a deadline and 1k limit is actually quite procrastonation inducing for me...
140 bytes forces me to experiment and not over think.

------
thomasfl
So happy to see some fellow norwegian developers mentioned here.

------
dang
Discussed in 2017:
[https://news.ycombinator.com/item?id=13700698](https://news.ycombinator.com/item?id=13700698)

------
ghthor
Where is the Javascript running, the backend or the in my browser?

~~~
pajtai
It's running in the browser. Right click inspect to see it.

------
datlife
Truly amazing website. Being transition to learn JS/Typescript lately, I come
to understand how powerful this scripting language is to power the whole
Internet.

------
hsavit1
I think this idea is cool, but I cant read this inline javascript. To the
creators of this site, please add an option to view the code formatted with
prettier

------
n-gauge
you could probably golf this classic one with your method:

<div id=B text=snow
bgColor=0><script>Ô=setInterval("m='';c=Math.cos;for(ô=0;ô<65;)m+='<p
style=position:absolute;top:'+(42+(z=399/(73-(++ô+Ô++&63)))
_c(ô_.9))+'%;left:'+(50+z*c(ô))+(z>>3?'%>.':'%;color:#456>.');B.innerHTML=m",49)</script>

------
aw3c2
Are there any tutorials for getting started with this?

~~~
zzzzzzzzzzz
wiki:

[https://github.com/lionleaf/dwitter/wiki](https://github.com/lionleaf/dwitter/wiki)

some write-ups:

[http://jsriffs.blogspot.com/](http://jsriffs.blogspot.com/)

[http://zozuar.org/txt/chalice/](http://zozuar.org/txt/chalice/)

[http://zozuar.org/txt/sc/](http://zozuar.org/txt/sc/)

------
catacombs
More validation that I'm a shitty JS developer.

------
singularity2001
> function u(t) {

why does he not use

u=t=>

~~~
sigvef
I hadn't learned about arrow functions yet when it was written in 2015 :)

