Skip to content

Instantly share code, notes, and snippets.

@noboko
Created March 4, 2013 14:09
Show Gist options
  • Save noboko/5082448 to your computer and use it in GitHub Desktop.
Save noboko/5082448 to your computer and use it in GitHub Desktop.
Plaskでunderscore.js使ってみるテスト
//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