View on GitHub

VNJS Animation and Scripting Engine

VNJS Standard Library

Standard Objects

Rectangle Object

A canvas element that draws a rectangle on the screen. The rectangle can have rounded corners.

Constructor Properties:

Examples

A rectangle with a 50% transparent fill, a black edge, and rounded corners;

const my_rectangle = Rectangle(
    width:         400,
    height:        150,
    corner_radius: 75,
    fill_style:    'hsla(211, 70%, 10%, .5)',
    stroke_style:  'black',
    line_width:    1.5,
  );

A rectangle with a linear gradient fill;

const my_linear_gradient = LinearGradient(
    x1: 0, y1: -200,
    x2: 0, y2: +200,
  );
my_linear_gradient.addColorStop(stop:0, color:'hsla(211, 40%, 10%, 0)');
my_linear_gradient.addColorStop(stop:1, color:'hsla(211, 40%,  1%, 1)');

const my_rectangle = Rectangle(
    width:         400,
    height:        400,
    corner_radius: 75,
    fill_style:    my_linear_gradient,
  );

TextTrail Object

A canvas element that draws and animates a Text Trail on the screen. A Text Trail is an area in which a string of text is measured and formatted to fit within the area. The text may contain basic HTML markup to change font weight, color and font style. This canvas element supports an animation sequence that renders the text word by word.

Constructor Properties:

Examples

LinearGradient Object

A styling object for a linear gradient.

Constructor Properties:

Mutator Functions:

Examples

RadialGradient Object

A styling object for a radial gradient.

Constructor Properties:

Mutator Functions:

Examples