module Avar:sig..end
Animated variables.
An Avar.t is a variable that evolves in time. It is updated at every frame (i.e. every iteration of the main loop). Bogue uses Avars for animations.
type 'a t
typecallback =unit -> unit
val create : ?duration:Time.t ->
?init:callback ->
?ending:callback ->
?finished:bool ->
?update:('a t -> float -> 'a) -> 'a -> 'a tGeneric Avar creation. If finished = true, the var never gets further
updated, ie behaves like a normal variable. Otherwise, the update
parameter is compulsory.
update : is a function such that update v s : 'a should give the
value of the Avar v at the time s. The meaning of the time s is
described in Avar.progress.val apply : ('a -> 'b) -> 'a t -> 'b tapply f v creates a new Avar by composing with f; the old Avar v
is still active
val fromto : ?duration:int ->
?ending:callback -> int -> int -> int tfromto x1 x2 creates a integer Avar.t with initial value x1 and, as
time elapses, moves continuously to x2, with a final slowdown.
val fromto_unif : ?duration:int ->
?ending:callback -> int -> int -> int tSimilar to Avar.fromto but with uniform speed (no slowdown).
val oscillate : ?duration:int -> ?frequency:float -> int -> int -> int toscillate amplitude x0 will oscillate with the given amplitude around
the initial value x0
val var : 'a -> 'a tCreate an Avar which behaves like a normal Var (no animation).
val get : 'a t -> 'aStart the animation (if necessary) and compute the current value of the variable.
val progress : 'a t -> floatprogress v is a float in [0,1] giving the percentage of the animation
when the last v.value was computed. In case of infinite animation, this
is just the elapsed Time (in ms).
val reset : 'a t -> unittype direction =
| |
No |
| |
Left |
| |
Right |
| |
Top |
| |
Bottom |
| |
TopLeft |
| |
TopRight |
| |
BottomLeft |
| |
BottomRight |
| |
Random |