Core Props Examples       Comp Projects

Set And Goto Commands

Every Prop type (may that be AniBoolean or AniString) has two very important methods called "set" method and "goto" method. Both of these are very important and powerful.

Before we dive into "set" and "goto" methods lets understand that a bilza animation has 2 states.

  1. The compile Time State:
  2. Compile time is when the animation is being read (compiled) by Javascript compiler (in the browser) but has not yet started the execution. It means that the compiler has not yet reached "bil.start" statement.

  3. The Run Time State:
  4. Once the Javascript compiler executes "bil.start" it starts running the animation in a loop and thus this state is called the run-time or running state.

In Simple words the life of bilza.js animation while it is being executed in the browser can be divided into 2 parts: first before the compiler has started the animation loop and second after that point.

It is important to understand that since the "set" method is for compile time and "goto" method is for run-time.

set(value :T)

  1. The "set" method will set the initial value of a property.
  2. Every time we call "set" method it over writes the previously set initial value of the prop thus only the last set value is appiled.
  3. The "set" method sets the initial value of a prop and does not have any control over the value once the animation starts running.

goto(AtTimeSec :number, value :T)

  1. Using goto method we can set the value of any prop at a specific time during animation.
  2. First argument "AtTimeSec" is the second at which the change should happen and the second argument is the value.

The input values of both the method is of type the prop represents. For example if we are dealing with AniBoolean the input for both methods is a boolean and if we are dealing with AniNumber then the input is a number.