             {x, y} = sprite_position_at(sprite, t)
             with_graphics_context (ctx) ->
               ctx.translate x, y
-              sprite.draw s
+              sprite.draw ctx, s
       t += step_size
 
 with_animation_context = (options, cb) ->

      t0: 0
      t1: 12
      z_index: 1
      path:
        0: {x: 0, y: 50}
        1: {x: 400, y: 50}
      draw: (s) ->
        s *= 12
        pitch = Math.floor(s)
        bend = s - pitch
        positions = finger_positions_on_chord(chord, pitch)
        with_graphics_context (ctx) ->
          draw_chord_diagram ctx, positions, dy: bend * ChordDiagramStyle.fret_height

        pitch = (pitch + 1) % 12
        bend -= 1
        positions = finger_positions_on_chord(chord, pitch)
        with_graphics_context (ctx) ->
          draw_chord_diagram ctx, positions, dy: bend * ChordDiagramStyle.fret_height

    animation.make_sprite
      draw: ->

        fingering = best_fingering_for(chord, pitch)
        pos = sprite_position_at master_diagram, t0
        [col, row] = [i % 4 , Math.floor(i / 4)]

        animation.make_sprite
          t0: t0
          draw: (ctx, dt) ->
            draw_title "#{chord_name} Major", font: '12pt Times', fillStyle: 'black', y: -3
            draw_chord_diagram ctx, fingering.positions, barres: fingering.barres

        , (sprite) ->
          sprite.at 0, pos
          sprite.at 1, x: 50 + col * 130, y: pos.y + 100 + row * 115

module.exports = chord_shape_flipbook
