

Same as drawPolygon, except the shape's interior is filled. fillPolygon(shape, x?, y?)įills a polygon, offset by the optional x,y position. Shape: either a list of points (such as ,]) or a polygon object as returned by makePolygon or rotatePolygon. drawPolygon(shape, x?, y?)ĭraws the outline of a polygon, offset by the optional x,y position. Same as drawCircle, except the shape's interior is also filled, and thick is not used. fillCircle(x, y, r)įill a circle with x,y as the upper-left point, and radius of r. Other values will be rounded to the nearest half-integer. If r is 0.5 more than some integer, the circle will instead span an odd number of pixels from one edge to the other. If this is an integer, then the number of pixels from the top or left edge of the top of left pixel to the other extreme will equal r * 2, an even number. The radius is not changed by specifying thick. If it is, the thick is measured from the outside edge of the circle and goes inward. The circle will be a ring 1 pixel wide, unless thick is specified. Returns a polygon oscil()ĭraw a circle with x,y as the upper-left point, and radius of r. Rotates the given polygon by the given angle, returning a new polygon. Returns a polygon rotatePolygon(shape, angle) Shape: Either a list of points or a polygon. Returns an image, opened but not necessarily loaded makePolygon(shape)Ĭonverts a set of a points into a polygon. Either a local filesystem path or a web accessible URL. Raster.js guarantees that all images opened will be fully loaded once the render function is invoked, assuming that the images can be loaded without error.įilename: the name of the image to load. To do this, call loadImage at the top-level of your script, and then only use drawImage inside of a render function that is passed to show or run. However, in order to keep scripts portable, it is recommended to also handle async environments, such as web browsers. In some environments, such as node.js, loadImage is synchronous, so images are opened and read all at once. Can be passed to drawImage once reading has completed. Loads an image, by opening it and reading its contents. Either the name of a pre-existing display, or a display object.Īscii: When running in a terminal, output ascii art to stdout. The display to use, instead of the default display. Pico8: Colors used by the Pico-8 fantasy console. Zx-spectrum: Colors used by the ZX Spectrum 8-bit computer.Ĭ64: Colors used by the Commodore 64 8-bit computer. Gameboy: Colors used by the Gameboy handheld console. Grey: Grey scale colors, from black to white. Nes: Colors used by the NES 8-bit console. 64 colors, a quick and simple rainbow palette.ĭos: Colors used by the DOS operating system. Quick: The current default colorMap, shown above. If not invoked, the current default colorMap is this: May either be the name of a pre-existing colorMap, or a list of rgb values. useColors(colorMap)Īssigns the colorMap to use for displaying the scene. Move the x,y coordinate system's origin to the center of the plane, instead of the upper-left. Show the grid on top of the display, spaced out the given number of units. Also used by discovery services to determine the name of a script without running it. If the display is in a window, sets the title of that window. Set the zoom level, in other words, the size of a single pixel as it appears on the physical viewing screen. Set the size of the display and standard plane, in pixels.
