0.0.1 • Published 9 years ago

learn-plot v0.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
9 years ago

Learn Plot

Learn Plot is a simple nodejs module used as a learning tool. It creates a 128 x 128 sized window and couple global functions plot and clearPlots. These functions act on the window creating little squares with color.

plot( x, y, color=black )

Creates a single pixel-like square with a color.

clearPlots( color=black )

Clears all plots setting whole window to a single color.

The color argument

The color argument accepts regular JavaScript objects that have the members: red, green, blue or r, g, b respectively. The value of these members can range from 0 to 255.

Example Use

require("learn-plot");

// Define some colors for easy use.
var red = {
  red: 255,
  green: 0,
  blue: 0
};

var green = {
  red: 0,
  green: 255,
  blue: 0
};

var blue = {
  red: 0,
  green: 0,
  blue: 255
};

// Plot a pixel at each corner
plot(0, 0, red);
plot(0, 127, green);
plot(127, 0, green);
plot(127, 127, red);