Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/soulwire/sketch.js
Browse files Browse the repository at this point in the history
  • Loading branch information
soulwire committed Nov 25, 2016
2 parents f95e621 + a68b947 commit 2ec40d9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ sketch.js lets you get straight to the fun parts of creative coding, without eve
It gives you a graphics context, an animation loop, normalised input events and a host of useful callbacks to hook into.

Here's an example:

Sketch.create({
setup: function() {
this.r = this.g = this.b = random( 100, 200 );
},
mousemove: function() {
this.r = 255 * ( this.mouse.x / this.width );
this.g = 255 * ( this.mouse.y / this.height );
this.b = 255 * abs( cos( PI * this.mouse.y / this.width ) );
},
draw: function() {
this.fillStyle = 'rgb(' + ~~this.r + ',' + ~~this.g + ',' + ~~this.b + ')';
this.fillRect( 0, 0, this.width, this.height );
}
});
````javascript
Sketch.create({
setup: function() {
this.r = this.g = this.b = random( 100, 200 );
},
mousemove: function() {
this.r = 255 * ( this.mouse.x / this.width );
this.g = 255 * ( this.mouse.y / this.height );
this.b = 255 * abs( cos( PI * this.mouse.y / this.width ) );
},
draw: function() {
this.fillStyle = 'rgb(' + ~~this.r + ',' + ~~this.g + ',' + ~~this.b + ')';
this.fillRect( 0, 0, this.width, this.height );
}
});
````

[See it in action](http://jsfiddle.net/soulwire/7wtbm/)

Expand Down
2 changes: 2 additions & 0 deletions examples/particles.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ <h3>Start drawing!</h3>
};

demo.spawn = function( x, y ) {

var particle, theta, force;

if ( particles.length >= MAX_PARTICLES )
pool.push( particles.shift() );
Expand Down

0 comments on commit 2ec40d9

Please sign in to comment.