Stop
Continue
Go
/* Animation Loop This code demonstrates using the animation loop to draw a moving circle. In this example, we use velocity variables to specify how fast the circle moves. The circle will start at a random position and move with a random velocity. Modular arithmetic is used to force the circle to wrap around when it goes off one side of the canvas. */ var x,y; //Circle coordinates var vx, vy; //Circle velocity function setup(){ //Set the initial position and velocity x=random()*width; y=random()*height; //velocity will be between -0.5 and 0.5 vx=random()-0.5; vy=random()-0.5; timestep(1); //timestep loop(); //animation loop } function draw(){ //clear canvas for next frame clear(); //draw filled circle circle(x,y,10); fill(); //update x coordinate to move the circle x=(x+vx+width)%width; y=(y+vy+height)%height; }
default
3024-day
3024-night
ambiance
base16-dark
base16-light
blackboard
cobalt
eclipse
elegant
erlang-dark
lesser-dark
mbo
mdn-like
midnight
monokai
neat
night
paraiso-dark
paraiso-light
pastel-on-dark
rubyblue
solarized dark
solarized light
the-matrix
tomorrow-night-eighties
twilight
vibrant-ink
xq-dark
xq-light