# set

The SVG set element provides a simple means of just setting the value of an attribute for a specified duration.

It supports all attribute types, including those that cannot reasonably be interpolated, such as string and boolean values. For attributes that can be reasonably be interpolated, the animate is usualy prefered.

Note: The set element is non-additive. The additive and accumulate attributes are not allowed, and will be ignored if specified.

Usually, this element is created with:

const set = parentElement.add('set')

It's possible to create it as a disconnected element with gySVG('set') and attach it to the SVG document with .attachTo().

More info: mdn (opens new window) | w3c (opens new window)

# .to()

set.to( value )

Set this attribute defines the value to be applied to the target attribute for the duration of the animation. The value must match the requirements of the target attribute.

  • argument: {number|string} value the value for the attribute during the duration of the element

  • returns: {gySVGObject} The original object

const to = element.to();

Get the to current value.