Set

Set.push()

Adds each argument to the current set

Returns: object original element

Set.pop()

Removes last element and returns it

Returns: object element

Set.forEach(callback, thisArg)

Executes given function for each element in the set

If the function returns false, the loop stops running.

Parameters

  1. callback function function to run
  2. thisArg object context object for the callback

Returns: object Set object

Set.animate(…)

Animates each element in set in sync.

Parameters

  1. attrs object key-value pairs of destination attributes
  2. duration number duration of the animation in milliseconds
  3. easing function easing function from mina or custom
  4. callback function callback function that executes when the animation ends

or

Parameters

  1. animation array array of animation parameter for each element in set in format [attrs, duration, easing, callback]

Usage

// animate all elements in set to radius 10
set.animate({r: 10}, 500, mina.easein);
// or
// animate first element to radius 10, but second to radius 20 and in different time
set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);

Returns: Element the current element

Set.bind(…)

Specifies how to handle a specific attribute when applied to a set.

Parameters

  1. attr string attribute name
  2. callback function function to run

or

Parameters

  1. attr string attribute name
  2. element Element specific element in the set to apply the attribute to

or

Parameters

  1. attr string attribute name
  2. element Element specific element in the set to apply the attribute to
  3. eattr string attribute on the element to bind the attribute to

Returns: object Set object

Set.clear()

Removes all elements from the set

Set.splice(index, count, [insertion…])

Removes range of elements from the set

Parameters

  1. index number position of the deletion
  2. count number number of element to remove
  3. insertion… object elements to insert

Returns: object set elements that were deleted

Set.exclude(element)

Removes given element from the set

Parameters

  1. element object element to remove

Returns: boolean true if object was found and removed from the set