ReferenceanimateFromSequence

<animateFromSequence/>

Animates a value through a sequence over time

<animateFromSequence/> is a General Operator component that renders an animation of a changing component over a specified interval of uniform steps.

Attributes and Properties

Attributes for <animateFromSequence>

Other (11)
allowAdjustmentsWhileRunning

boolean. Default value: false. Whether sequence parameters can be adjusted while the animation is running.

number. Default value: 1000. Time in milliseconds between successive animation steps.

keyword. How the animation steps through the sequence.

ValueDescription
increase (default)Step through values from first to last, looping back to the start.
decreaseStep through values from last to first, looping back to the end.
increase onceStep from first to last and stop without looping.
decrease onceStep from last to first and stop without looping.
oscillateStep from first to last, then reverse direction at each end.

boolean. Default value: false. Whether the animation is currently playing.

_componentListWithSelectableType. Values to exclude from the sequence.

_componentWithSelectableType. The first value in the sequence.

integer. The number of values in the sequence.

math. The increment between successive values in the sequence.

reference. Reference to the state variable that will be animated.

_componentWithSelectableType. The last value in the sequence. Used together with from to determine length when length is not specified.

type

keyword. The kind of values in the sequence.

ValueDescription
numberA sequence of numeric values.
mathA sequence of math expressions (allows symbolic from/to/step).
lettersA sequence of letters (single-letter or multi-letter labels).
Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <animateFromSequence name="a">

Other (11)
$a.allowAdjustmentsWhileRunning

boolean. Whether sequence parameters can be adjusted while the animation is running.

$a.animationInterval

number. Time in milliseconds between successive animation steps.

$a.animationMode

text. How the animation steps through the sequence.

$a.animationOn

boolean. Whether the animation is currently playing.

text. Current direction of the animation ("increase" or "decrease"; flips during oscillation).

$a.disabled

boolean. Whether this component is disabled and cannot be interacted with.

$a.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$a.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$a.hidden

boolean. Whether this component is hidden from the rendered output.

number. Index of the currently selected value in the sequence (1-based).

The currently selected value of the animation.

Common to all components (4)
$a.doenetML

text. The DoenetML source code that produced this component.

$a.hide

boolean. Whether to hide this component from the rendered output.

$a.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$a.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: Animated counting

The <animateFromSequence/> component is used to animate a <number> over a sequence of values from 1 to 20.


Example: Animation with start/stop button

A <callAction> component references a named <animateFromSequence /> with the actionName set to toggleAnimation.


Example: Animated circle radius

The <animateFromSequence /> component is used to animate the radius of a <circle> where the radius has been defined as a <number/> over a sequence of values from 0 to 10.


Example: Point moving along a function

The <animateFromSequence /> component is used to animate the xx-coordinate of a point which has been defined as a <number/> over a sequence of values from -9 to 9. The yy-coordinate of the point is defined with the function evaluation reference $$f(x).

Attribute Examples

Attribute Example: target

The target attribute is used to specify the value to animate. Since points have a numerical property corresponding to their xx-coordinate, this value can be animated directly without having to define a separate <number/>.


Attribute Example: animationOn

The animationOn attribute is used to specify the current state of the animation. This attributes takes a boolean value or an expression which evaluates to a boolean. In this particular example the boolean value is specified by the user with a <booleanInput/>.


Attribute Example: animationMode

The animationMode attribute is used to specify the directional behavior of the animation. Valid values for the input text are: increase, increase once, decrease, decrease once, and oscillate. The default value is increase.


Attribute Example: animationInterval

The yy-coordinate of two points are both animated with the <animateFromSequence /> component, and the user must specify the input value for the animationInterval attribute for each point. The length of the animationInterval governs the amount of time elapsed between successive steps of the animation sequence. The default value is 1000 ms.


Attribute Example: type=“letters”

The type attribute takes either “letters” or “number” as a text input. If unspecified, the default type is “number”.


Attribute Example: length

The length attribute specifies the length, in number of terms, of the animation sequence.


Attribute Example: from, to

The from and to attributes specify the starting and ending values in the animation sequence.


Attribute Example: step

The step attribute specifies the size of each increment in the animation sequence. The default step is 11.


Attribute Example: exclude

The exclude attribute specifies values to exclude in the animation sequence.

Property Examples

Property Example: Attributes as properties

The above listed <animateFromSequence/> attributes are also accessible as properties.


Property Example: value

The value property of the <animateFromSequence/> component renders the current sequence value of the animation target.


Property Example: currentAnimationDirection

The currentAnimationDirection property of the <animateFromSequence/> component renders the current direction of the animation; i.e. whether the sequence values are increasing or decreasing.


Property Example: selectedIndex

The selectedIndex property returns the index number of the current sequence value.