Running Python Code in a Browser

From this very old Processing forum thread:
https://Forum.Processing.org/one/topic/the-nature-of-code-code-solutions-of-the-examples.html

There’s this “Bouncing Ball 3D” sketch for both Java Mode:
http://Studio.ProcessingTogether.com/sp/pad/export/ro.9o1T5z1ghf2s7

And for CoffeeScript Mode:

###
Bouncing Ball 3D (v2.1)
Mod GoToLoop

https://Forum.Processing.org/one/topic/
the-nature-of-code-code-solutions-of-the-examples

Studio.ProcessingTogether.com/sp/pad/export/ro.9o1T5z1ghf2s7
###

BALL_DIM = 30; CUBE_DIM = 450; CUBE_RAD = CUBE_DIM >> 1
location = velocity = null
cx = cy = 0

setup: ->
  size 400, 400, P3D; strokeWeight 2
  location = new PVector; velocity = new PVector 3, 2, 4
  cx = width >> 1; cy = height >> 1


draw: -> background -1; do drawCube; do moveSphere; do drawSphere


drawCube = ->
  #move cube and ball to center:
  translate cx, cy, -CUBE_DIM

  #rotate cube and ball so its 3D-ness can be appreciated:
  rotateX -QUARTER_PI; rotateY QUARTER_PI; rotateZ .5 * QUARTER_PI

  do noFill; stroke 0; box CUBE_DIM


drawSphere = ->
  translate location.x, location.y, location.z
  fill `0300`; do noStroke; do lights; sphere BALL_DIM


moveSphere = ->
  location.add velocity #move ball

  #detect edges with center at 0,0 and edge minus width of ball:
  velocity.x *= -1 if checkBounce location.x
  velocity.y *= -1 if checkBounce location.y
  velocity.z *= -1 if checkBounce location.z


checkBounce = (coord) -> coord > CUBE_RAD - BALL_DIM or coord < BALL_DIM - CUBE_RAD