       sprite.y = sup.y
       container.addChild(sprite)
     return container
-  
+
   createPath: (points, options={}) ->
     options = options or {}
     interval = options.interval or 8
     key = options.frameKey or @pastDotKey
     container = new createjs.SpriteContainer(@layerAdapter.spriteSheet)
-      
+
     for x, i in points by interval * 2
       y = points[i + 1]
       sprite = new createjs.Sprite(@layerAdapter.spriteSheet)

    pathDisplayObject.addChild @createTargets()
    @generatingPaths = false
    return pathDisplayObject
    
  cleanUp: ->
    createjs.Tween.removeTweens(sprite) for sprite in @tweenedSprites
    @tweenedSprites = []
    @tweens = []

  createGraphics: ->
    @targetDotKey = @cachePathDot(TARGET_WIDTH, @colorForThang(@thang.team, TARGET_ALPHA))
    @pastDotKey = @cachePathDot(PAST_PATH_WIDTH, @colorForThang(@thang.team, PAST_PATH_ALPHA))
    @futureDotKey = @cachePathDot(FUTURE_PATH_WIDTH, @colorForThang(@thang.team, FUTURE_PATH_ALPHA))
    
  cachePathDot: (width, color) ->
    key = "path-dot-#{width}-#{color}"
    color = createjs.Graphics.getRGB(color...)
    unless key in @layerAdapter.spriteSheet.getAnimations()
      circle = new createjs.Shape()
      radius = width/2
      circle.graphics.setStrokeStyle(width/5).beginFill(color).beginStroke('#000000').drawCircle(0, 0, radius)
      @layerAdapter.addCustomGraphic(key, circle, [-radius*1.5, -radius*1.5, radius*3, radius*3])
    return key


PAST_PATH_ALPHA = 0.75
PAST_PATH_WIDTH = 5
FUTURE_PATH_ALPHA = 0.75
FUTURE_PATH_WIDTH = 4
TARGET_ALPHA = 1
TARGET_WIDTH = 10
FUTURE_PATH_INTERVAL_DIVISOR = 4
PAST_PATH_INTERVAL_DIVISOR = 2

Camera = require './Camera'
CocoClass = require 'lib/CocoClass'

module.exports = class TrailMaster extends CocoClass
  world: null

  constructor: (@camera, @layerAdapter) ->
    super()
    @tweenedSprites = []
