examples/custom.js
function drawLoop () {
  ctx.clearRect(0, 0, canvas.width, canvas.height)

  var centerX = canvas.width / 2
  var centerY = canvas.height / 2

  // draw circle
  ctx.beginPath()
  ctx.arc(centerX, centerY, 100, 0, 2 * Math.PI, false)
  ctx.fillStyle = 'yellow'
  ctx.fill()

  // draw three oscilloscopes in different positions and colors
  ctx.strokeStyle = 'lime'
  scope.draw(ctx, 0, 0, centerX, centerY)

  ctx.strokeStyle = 'cyan'
  scope.draw(ctx, centerX, 0, centerX, centerY)

  ctx.strokeStyle = 'red'
  scope.draw(ctx, 0, centerY, null, centerY)

  window.requestAnimationFrame(drawLoop)
}
function drawLoop () {
  ctx.clearRect(0, 0, canvas.width, canvas.height)

  var centerX = canvas.width / 2
  var centerY = canvas.height / 2

  // draw circle
  ctx.beginPath()
  ctx.arc(centerX, centerY, 100, 0, 2 * Math.PI, false)
  ctx.fillStyle = 'yellow'
  ctx.fill()

  // draw three oscilloscopes in different positions and colors
  ctx.strokeStyle = 'lime'
  scope.draw(ctx, 0, 0, centerX, centerY)

  ctx.strokeStyle = 'cyan'
  scope.draw(ctx, centerX, 0, centerX, centerY)

  ctx.strokeStyle = 'red'
  scope.draw(ctx, 0, centerY, null, centerY)

  window.requestAnimationFrame(drawLoop)
}
function drawLoop ( ) { ctx . clearRect ( 0 , 0 , canvas . width , canvas . height ) var centerX = canvas . width / 2 var centerY = canvas . height / 2 // draw circle ctx . beginPath ( ) ctx . arc ( centerX , centerY , 100 , 0 , 2 * Math . PI , false ) ctx . fillStyle = 'yellow' ctx . fill ( ) // draw three oscilloscopes in different positions and colors ctx . strokeStyle = 'lime' scope . draw ( ctx , 0 , 0 , centerX , centerY ) ctx . strokeStyle = 'cyan' scope . draw ( ctx , centerX , 0 , centerX , centerY ) ctx . strokeStyle = 'red' scope . draw ( ctx , 0 , centerY , null , centerY ) window . requestAnimationFrame ( drawLoop ) }
custom animation loop
custom animation loop