Skip to main content
added 520 characters in body
Source Link
manatwork
  • 20.9k
  • 5
  • 53
  • 82

Ruby with Shoes, 159 bytes

Shoes.app{animate{background stroke white fill purple r=0.75*c=self.width/2 t=Time.now m=Math rect c+r*m.sin(a=(t.sec+t.usec*1e-6)*m::PI/30),c-r*m.cos(a),2,2}} 

TakesThe pixel is actually the tip of an analog clock's seconds hand. So this one is absolutely precise.

Ruby with Shoes, 134 bytes

m=Math Shoes.app{animate{|f|r=0.75*c=self.width/2 background stroke white fill purple rect c+r*m.sin(a=f*m::PI/360),c-r*m.cos(a),2,2}} 

This is a frames-per-seconds based alternative, inspired by the other answers. Although the documentation says the default fps is 10, practical tests shows it is actually 12.

Both solutions take “The width of the circle should be 0.75 (rounding suitably) the width of the screen or window” literally: calculatescalculate based on windowswindow width, so the pixel occasionally may leave the bottom of a non-square window. NutNot sure how such case is expected to be handled. (Use minimum of width and height? Walk on oval path?) The window starts with default 600 x 500 size and is resizable.

Ruby with Shoes, 159 bytes

Shoes.app{animate{background stroke white fill purple r=0.75*c=self.width/2 t=Time.now m=Math rect c+r*m.sin(a=(t.sec+t.usec*1e-6)*m::PI/30),c-r*m.cos(a),2,2}} 

Takes “The width of the circle should be 0.75 (rounding suitably) the width of the screen or window” literally: calculates based on windows width, so the pixel occasionally may leave the bottom of a non-square window. Nut sure how such case is expected to be handled. (Use minimum of width and height? Walk on oval path?) The window starts with default 600 x 500 size and is resizable.

Ruby with Shoes, 159 bytes

Shoes.app{animate{background stroke white fill purple r=0.75*c=self.width/2 t=Time.now m=Math rect c+r*m.sin(a=(t.sec+t.usec*1e-6)*m::PI/30),c-r*m.cos(a),2,2}} 

The pixel is actually the tip of an analog clock's seconds hand. So this one is absolutely precise.

Ruby with Shoes, 134 bytes

m=Math Shoes.app{animate{|f|r=0.75*c=self.width/2 background stroke white fill purple rect c+r*m.sin(a=f*m::PI/360),c-r*m.cos(a),2,2}} 

This is a frames-per-seconds based alternative, inspired by the other answers. Although the documentation says the default fps is 10, practical tests shows it is actually 12.

Both solutions take “The width of the circle should be 0.75 (rounding suitably) the width of the screen or window” literally: calculate based on window width, so the pixel occasionally may leave the bottom of a non-square window. Not sure how such case is expected to be handled. (Use minimum of width and height? Walk on oval path?) The window starts with default 600 x 500 size and is resizable.

Source Link
manatwork
  • 20.9k
  • 5
  • 53
  • 82

Ruby with Shoes, 159 bytes

Shoes.app{animate{background stroke white fill purple r=0.75*c=self.width/2 t=Time.now m=Math rect c+r*m.sin(a=(t.sec+t.usec*1e-6)*m::PI/30),c-r*m.cos(a),2,2}} 

Takes “The width of the circle should be 0.75 (rounding suitably) the width of the screen or window” literally: calculates based on windows width, so the pixel occasionally may leave the bottom of a non-square window. Nut sure how such case is expected to be handled. (Use minimum of width and height? Walk on oval path?) The window starts with default 600 x 500 size and is resizable.