Name

animator (LzAnimator) — Changes the value of another object's attribute over time.

Synopsis

LZX: animator
JavaScript: LzAnimator
Type: Class
Access: public
Topic: LFC.Animation
Declared in: WEB-INF/lps/lfc/controllers/LaszloAnimation.lzs

Description

LzAnimator

Animators change the value of an object's attribute over a specified duration in milliseconds. For example, the following program defines an animator for a window that moves it to a position of x=100 over 1 second (1000 milliseconds).

codefalse
 <canvas>
   <window>
     <animator attribute="x" to="100" duration="1000"/>
   </window>
 </canvas>
 

See the Guide for a complete discussion of animators and animation in Laszlo applications.

Superclass Chain

node (LzNode) » animatorgroup (LzAnimatorGroup) » animator (LzAnimator)

Known Subclasses

Details

Properties (3)

attribute
<attribute name="attribute" type="token" />
public var attribute : String;
The name of the attribute whose value is animated. This attribute is required on an animator, unless the animator is inside an animatorgroup that specifies an attribute.
beginPoleDelta
<attribute name="beginPoleDelta" />
public var beginPoleDelta = 0.25;
endPoleDelta
<attribute name="endPoleDelta" />
public var endPoleDelta = 0.25;

Setters (2)

Setters for virtual properties, to be used with setAttribute. A setter may or may not have a corresponding getter method; consult the Methods list in this section.

motion
The style of motion to use for the animator. This is one of "linear", "easin" , "easeout" , and "easeboth". The default is "easeboth"
to
The destination value for the animator.

Methods (15)

beginAnimator()
<method name="beginAnimator" args="time" />
private function beginAnimator(time : Number);
beginAnimator is called on the first iteration of the animator.
calcControlValues()
<method name="calcControlValues" args="cval" />
private function calcControlValues(cval);
Calculate the control values fro the animation. These will not change even if the animation is repeated.
calcNextValue()
<method name="calcNextValue" args="timeDifference" />
private function calcNextValue(timeDifference) : nextValue;
This method calculates the next value of the parameter being animated. This method can be used by any Animator object that inherits from LzAnimator, as long as the parameter is a scalar value (i.e. a number instead of a point).
calcNextValueLinear()
<method name="calcNextValueLinear" args="timeDifference" />
private function calcNextValueLinear(timeDifference);
This method replaces the nonlinear calcNextValue when motion is set to linear
construct()
<method name="construct" args="parent, args" />
private function construct(parent, args);
doStart()
<method name="doStart" />
private function doStart();
this is called once to set any starting values that will only need to be calculated once even if the animator repeats BRET'S NOTE: this.target.setAttribute( this.attribute , this.from ); not true if relative if doStart is called while animator is active, just return else if a "from" value has been specified then this Here is where the expected value for a view should be updated
__LZfinalizeAnim()
<method name="__LZfinalizeAnim" />
private function __LZfinalizeAnim();
prepareStart()
<method name="prepareStart" />
private function prepareStart();
resetAnimator()
<method name="resetAnimator" />
private function resetAnimator();
reset the time variables and currentValue
setMotion()
<method name="setMotion" args="eparam" />
public function setMotion(eparam : String);
Sets the motion style for the animator.
setTo()
<method name="setTo" args="eparam" />
public function setTo(eparam : Number);
Sets the destination value for the animator
setValue()
<method name="setValue" args="value" />
private function setValue(value);
sets the property specified in the binding to the value
stop()
<method name="stop" />
private function stop();
toString()
<method name="toString" />
private function toString();
update()
<method name="update" args="time" />
private function update(time) : animatorIsDone;
This is one of the core methods of an LzAnimator object. This method gets called to iterate the animation only once and then sets the property of the associated view.

LZX Synopsis

<class name="LzAnimator" extends=" LzAnimatorGroup ">
  <attribute name=" attribute " type="token" />
  <attribute name=" beginPoleDelta " />
  <attribute name=" endPoleDelta " />
  <method name=" beginAnimator " args="time" />
  <method name=" calcControlValues " args="cval" />
  <method name=" calcNextValue " args="timeDifference" />
  <method name=" calcNextValueLinear " args="timeDifference" />
  <method name=" construct " args="parent, args" />
  <method name=" doStart " />
  <method name=" __LZfinalizeAnim " />
  <method name=" prepareStart " />
  <method name=" resetAnimator " />
  <method name=" setMotion " args="eparam" />
  <method name=" setTo " args="eparam" />
  <method name=" setValue " args="value" />
  <method name=" stop " />
  <method name=" toString " />
  <method name=" update " args="time" />
</class>

JavaScript Synopsis

public LzAnimator extends  LzAnimatorGroup  {
  public var attribute  : String;
  public var beginPoleDelta  = 0.25;
  public var endPoleDelta  = 0.25;
  prototype private function beginAnimator (time : Number);
  prototype private function calcControlValues (cval);
  prototype private function calcNextValue (timeDifference) : nextValue;
  prototype private function calcNextValueLinear (timeDifference);
  prototype private function construct (parent, args);
  prototype private function doStart ();
  prototype private function __LZfinalizeAnim ();
  prototype private function prepareStart ();
  prototype private function resetAnimator ();
  prototype public function setMotion (eparam : String);
  prototype public function setTo (eparam : Number);
  prototype private function setValue (value);
  prototype private function stop ();
  prototype private function toString ();
  prototype private function update (time) : animatorIsDone;
}