tmlib + javascript(coffeescript) エフェクト?

色々あってjavascript書いててバッドプラクティスいちいち面倒で、
coffeescript使いだした。
あとゲーム作成用にtmlibも使用。
参考URLvar.blog.jp
をちょっとしたタッチ演出用に書き換えてみた。
f:id:hayateasdf:20151104151246p:plain

SCREEN_WIDTH    = 465
SCREEN_HEIGHT   = 465
SCREEN_CENTER_X = SCREEN_WIDTH/2
SCREEN_CENTER_Y = SCREEN_HEIGHT/2

tm.main ->
    app = tm.display.CanvasApp("#world")
    app.background = "#222"
    app.resize(SCREEN_WIDTH, SCREEN_HEIGHT)
    app.fitWindow()
    app.replaceScene(MainScene())
    app.run()


tm.define "MainScene",

    superClass: "tm.app.Scene",

    init: ->
        @superInit()
        # @title = tm.display.Label("Sine Wave").setFillStyle("#eee").setPosition(SCREEN_CENTER_X, 30).addChildTo(this)
        @sineWave = user.SineWave().addChildTo(this)
        @sineWave.tweener
        .to({degree: 360}, 4000)
        .to({degree: 0}, 4000)
        .setLoop(true)

tm.define "user.SineWave",

    superClass: "tm.app.CanvasElement",

    init: ->
        @superInit()
        @degree = 0
        @_past_pos = {x: SCREEN_CENTER_X, y: SCREEN_CENTER_Y}

    update: (app) ->
        pos = app.pointing;
        if pos.getPointing()
            @_past_pos.x = pos.x
            @_past_pos.y = pos.y
            particle = user.Particle(
                angle: @degree
                x: @_past_pos.x
                y: @_past_pos.y
                width: 60
                height: 60
            ).addChildTo(this)
            particle.tweener.fadeOut(1100).call =>
                particle.remove()


tm.define "user.Particle",

    superClass: "tm.display.CircleShape",

    init: (param) ->
        @superInit(param.width, param.height,
            fillStyle: "hsla(#{param.angle}, 80%, 50%, 1.0)"
            strokeStyle: "transparent"
            blendMode: "lighter"
            position:
                x: param.x
                y: param.y
        )