Loop

A double behaviour that loops between two values over a fixed time period, starting back at the initial value once each loop has completed. An AnimationEvent is announced when each loop is completed. This behaviour is useful for spinning objects: animate the angle property of a Rotate transform to a Loop bean that loops between 0 and 2*pi.

Features

XML Element XML Type Java Class Activity
behaviour loop uk.ac.ic.doc.scenebeans.behaviour.Loop infinite

Properties

Name Type Default Value Getter Method Setter Method Description
from double 0.0 getFrom setFrom The initial value.
to double 0.0 getTo setTo The final value.
duration double 1.0 getDuration setDuration The duration of each loop.
value double 0.0 getValue read only The current value of the behaviour.
activityName double 0.0 getActivityName setActivityName The name of the behaviour, as announced in AnimationEvents when the behaviour completes. In XML documents, this property is usually specified by the name attribute of the <behaviour> element.
finite boolean false isFinite read only Returns whether the activity is finite. It isn't, so this always returns false.

Behaviour Facets

Name Behaviour Type Getter Method Description
n/a double n/a This behaviour is not facetted.

Example XML

<behaviour algorithm="loop" id="spinner">
  <param name="from" value="0"/>
  <param name="to" value="2*pi"/>
  <param name="duration" value="2.0"/>
</behaviour>
.......
<transform type="rotate">
  <animate param="angle" behaviour="spinner"/>
  <paste object="rotors"/>
</transform>