interface RVG · Factories

RvgValueFactory

interface RvgValueFactory

Factory for creating observable value containers that automatically propagate changes to dependent computations and visual elements.

Methods

bool

bool(): Bool

Creates a Bool value initialized to false.

Returns A Bool instance with value false.

bool(value: boolean): Bool

Creates a Bool value with the specified value.

value
The boolean value.

Returns A Bool instance.

integer

integer(): Integer

Creates an Integer value initialized to 0, e.g. a counter or a page index.

The value is not rounded: write whole numbers. Animate.integer animates it in whole steps.

Returns An Integer instance with value 0.

integer(value: number): Integer

Creates an Integer value with the specified whole number.

value
The whole number.

Returns An Integer instance.

item

item(value: any): Item

Creates an Item wrapping the specified object.

value
The object to wrap.

Returns An Item instance.

pin

pin(): Pin

Creates a pin initialized at the origin (0,0).

Returns A pin instance.

pin(p: Point | VectorLike): Pin

Creates a pin by copying an existing point.

p
The point to copy.

Returns A new pin instance.

point

point(): Point

Creates a point initialized at the origin (0,0).

Returns A point instance.

point(p: Point | VectorLike): Point

Creates a point by copying an existing point.

p
The point to copy.

Returns A new point instance.

real

real(): Real

Creates a Real value initialized to 0.

Returns A Real instance with value 0.

real(value: number): Real

Creates a Real value initialized to the specified number.

value
The numeric value.

Returns A Real instance.

realArray

realArray(): Sequence<number>

Creates an empty reactive array of numbers.

Returns A reactive sequence of numbers.

realArray(values: Iterable<number>): Sequence<number>

Creates a reactive array of numbers, e.g. the values of a data set. One dependency for many values: a Reactive.do on the array runs once per write, also when set replaces all numbers at once.

The numbers are stored (no Real per entry); read them with at(i), write one with the index or all with set. Animate.realArray animates all of them.

values
The numbers.

Returns A reactive sequence of numbers.

string

string(): StringValue

Creates an empty string value.

Returns A string instance with an empty string.

string(value: string): StringValue

Creates a string value with the specified string.

value
The string value.

Returns A string instance.