Created
March 4, 2013 14:09
-
-
Save noboko/5082448 to your computer and use it in GitHub Desktop.
Plaskでunderscore.js使ってみるテスト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//npm install underscore | |
var plask = require('plask'); | |
_ = require('underscore'); | |
plask.simpleWindow({ | |
init: function() { | |
this.framerate(60); | |
this.paint.setFill(); // Fill is the default, so this is just for clarity. | |
this.paint.setAntiAlias(true); | |
}, | |
draw: function() { | |
var canvas = this.canvas, paint = this.paint; | |
canvas.clear(100, 130, 300, 255); | |
_(100).times(function(num){ | |
paint.setColor(80, Math.floor((Math.sin(this.frametime) + 1)*127), Math.floor((Math.sin(num) + 1)*127), 255); | |
canvas.drawCircle(paint, Math.sin(this.frametime + num) * 200 + 200, num * 4, 20 ); | |
}, | |
this); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment