   , (animation) ->
 
     master_diagram = animation.make_sprite
+      name: "master"
       t0: 0
-      t1: 12
+      t1: 13
       z_index: 1
+      visible: not just_one
       draw: (ctx, s) ->
         s *= 12
-        pitch = Math.floor(s)
+        pitch = Math.floor s
+        pitch = Math.min 11, pitch
         bend = s - pitch
-        positions = finger_positions_on_chord(chord, pitch)
+        positions = finger_positions_on_chord chord, pitch
         draw_chord_diagram ctx, positions, dy: bend * ChordDiagramStyle.fret_height
 
         pitch = (pitch + 1) % 12
         bend -= 1
-        positions = finger_positions_on_chord(chord, pitch)
+        positions = finger_positions_on_chord chord, pitch
         draw_chord_diagram ctx, positions, dy: bend * ChordDiagramStyle.fret_height
 
       , (sprite) ->


ease = (s, x0, x1) ->x0 + s * (x1 - x0)

easeAttr = (path, aname, s, defaultValue) ->
  return defaultValue unless path and aname of path[0]
  ease(s, path[0][aname], path[1][aname])

sprite_position_at = (sprite, t) ->
  s = Math.min(1, (t - sprite.t0) / (sprite.t1 - sprite.t0))
  s = Math.min(1, t - sprite.t0) unless 't1' of sprite
  {
    x: easeAttr(sprite.path, 'x', s, 0)
    y: easeAttr(sprite.path, 'y', s, 0)
  }

write_animation_frames = (options) ->
  {step_size, sprites, end_padding} = options
  step_size ||= 1
  t_end = Math.max(_.chain(sprites).pluck('t1').compact().value()...)
  t_end += (end_padding or 0)
  t = 0
  with_book (options.title || "animation frames"), (book) ->
    ctx = book.context
    while t < t_end
      book.add_page ->
        with_page width: 640, height: 480, ->
          current_sprites = (sprite for sprite in sprites when (sprite.t0 or 0) <= t < (sprite.t1 or t_end))
          for sprite in _.sortBy(current_sprites, (s) -> (s.z_index or 0))
            s = Math.min(1, (t - sprite.t0) / (sprite.t1 - sprite.t0))
            s = t - sprite.t0 unless sprite.t1
            {x, y} = sprite_position_at(sprite, t)
            with_graphics_context (ctx) ->
              ctx.translate x, y
              sprite.draw ctx, s

  speed ||= (if quick then 10 else 1)
  chord = Chords[0]
  title = "#{chord.name} Chord Shapes"
  just_one = false

  with_animation_context
    title: "Chord Shape Animation Frames"
