surrender

0.0.0 • Public • Published

surrender

Draw lines and shapes on the terminal.

examples

rhombus.js

var render = require('surrender')({
    from : [ [ -1, 1 ], [ -1, 1 ] ]
});
 
render
    .line([ -0.7, 0 ], [ 0, -0.5 ])
    .line([ 0, -0.5 ], [ 0.7, 0 ])
    .line([ 0.7, 0 ], [ 0, 0.5 ])
    .line([ 0, 0.5 ], [ -0.7, 0 ])
;

output:




                                       \____
                                  /¯¯¯¯     \____
                             /¯¯¯¯               \___
                         /¯¯¯                        \____
                    /¯¯¯¯                                 \____
               /¯¯¯¯                                           \____
           \____                                                   /¯¯¯
                \____                                         /¯¯¯¯
                     \____                               /¯¯¯¯
                          \____                     /¯¯¯¯
                               \___            /¯¯¯¯
                                   \____   /¯¯¯



methods

var surrender = require('surrender')

var render = surrender(opts)

Create a new surrender object from opts.

The optional opts.from specifies a coordinate transform using coords so you don't need to think in cursor coordinates.

You can use opts.charm to pass in a custom charm instance.

render.line([ x0, y0 ], [ x1, y1 ])

Draw a line from [ x0, y0 ] to [ x1, y1 ].

Returns this.

install

Using npm do:

npm install surrender

license

MIT/X11

Dependents (1)

Package Sidebar

Install

npm i surrender

Weekly Downloads

3

Version

0.0.0

License

MIT/X11

Last publish

Collaborators

  • nopersonsmodules