dwitter.net

+ New dweet
function u(t) {
} //
122/140


Please log in (or register) to post a dweet (copy-paste the code somewhere safe to save it meanwhile)


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.
show FPS hide FPS share 1 remix fullscreen

function u(t) {

}//
126/140


Please log in (or register) to post as a new dweet (copy-paste code somewhere safe to save it meanwhile).

  • Spinning sticks
  • u/pavel
    I am glad I looked at the code here because I learned the trick of passing in C or S to differentiate X vs Y coordinate. I used to pass an offset angle of pi/2 but this is much shorter. Nice!
  • u/pavel
    For example this shaves off 6 chars from d/12567: for(c.width|=p=300;e=p--**.9%1;x.fillRect(960+r(S)/z,200+99/z,s=9*e/z,s))r=f=>p/(1+e*C(a=t/4+p))*f(a+p)+2*p/(1/e-e)*f(p),z=.5+r(C)/800
  • u/gpolonus
    Thanks! I'm glad my simple windmill could help :)

Please log in (or register) to comment.

u(t) is called 60 times per second. t: elapsed time in seconds. c: A 1920x1080 canvas. x: A 2D context for that canvas. S: Math.sin C: Math.cos T: Math.tan R: Generates rgba-strings, ex.: R(255, 255, 255, 0.5)