dwitter.net | joeytwiddle (2426)

+ 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.
Try the new frontend: beta.dwitter.net
Current theme challenge: #Opposites
show FPS hide FPS share fullscreen
remix of d/27238 by u/vgel

function u(t) {

}//
133/140


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

  • happy "orbits" nice try FBI

Please log in (or register) to comment.

show FPS hide FPS share fullscreen

function u(t) {

}//
125/140


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

Please log in (or register) to comment.

show FPS hide FPS share 1 remix fullscreen

function u(t) {

}//
140/140


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

  • u/joeytwiddle
    contrast(${T(t/5)} is interesting; less focus = more clarity

Please log in (or register) to comment.

show FPS hide FPS share fullscreen

function u(t) {

}//
140/140


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

Please log in (or register) to comment.

show FPS hide FPS share 1 remix fullscreen

function u(t) {

}//
140/140


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

  • u/joeytwiddle
    This is more efficient than fillRect() but it's too long! c.width|=c.style.filter='invert(100%)' (This way, we also need to change clearRect into fillRect)
  • u/magna
    c.style.filter='invert(' suffices since browsers are notoriously forgiving

Please log in (or register) to comment.

show FPS hide FPS share 1 remix fullscreen

function u(t) {

}//
134/140


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

Please log in (or register) to comment.

show FPS hide FPS share fullscreen

function u(t) {

}//
139/140


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

  • Rasta Bars

Please log in (or register) to comment.

show FPS hide FPS share 1 remix fullscreen

function u(t) {

}//
140/140


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

Please log in (or register) to comment.

show FPS hide FPS share fullscreen

function u(t) {

}//
140/140


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

  • u/magna
    Amazing!
  • u/jorduino
    The code you have provided is a JavaScript program that uses the u() function to draw an animation on an HTML canvas element. The u() function is called 60 times per second, and uses the elapsed time t as a parameter to create the animation. The code uses a number of shorthand functions and variables to simplify the implementation of the u() function. The S, C, and T variables are shorthand for the Math.sin(), Math.cos(), and Math.tan() functions, respectively. The R() function is used to generate rgba color strings, and the c and x variables represent the canvas element and its 2D context, respectively. The u() function uses a loop to iterate over a range of values for i, and uses these values to calculate the X, Y, and Z coordinates for each iteration. The X and Y coordinates are used to draw a rectangle on the canvas using the fillRect() method, and the Z coordinate is used to scale the rectangle and create the illusion of depth. The globalAlpha property is used to set the transparency of the rectangles, and the style.filter property is used to invert the colors of the canvas. Overall, this code appears to be a simple example of how the canvas element and the u() function can be used to create an animation in JavaScript. It uses some advanced features of the language, such as shorthand functions and the canvas element, to create a visually interesting effect.
  • u/joeytwiddle
    This gives a better distribution of particles: Y=((i-.1)**5+t*2)%13-9 no more grid, but a few clusters

Please log in (or register) to comment.

show FPS hide FPS share fullscreen

function u(t) {

}//
137/140


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

  • A minor remix, since Firefox got faster

Please log in (or register) to comment.

Loading...
Next page