maliang.animation.controllers¶
字数 9 个 阅读时间不到 1 分钟 访问量
源代码:maliang/animation/controllers.py
Controller generator and standard control functions.
Definition of control function:
t
: 0% ~ 100%, indicates the percentage of time- return: real number, indicates a multiple of the cardinality of the animation
函数:
-
generate
–Generate a control function from an ordinary mathematical function.
-
linear
–Speed remains the same.
-
smooth
–Speed is slow first, then fast and then slow. (slow -> fast -> slow)
-
rebound
–Before the end, displacement will bounce off a bit.
-
ease_in
–Gradually accelerate. (slow -> fast)
-
ease_out
–Gradually decelerate. (fast -> slow)
generate ¶
generate(
base: collections.abc.Callable[[float], float], start: float, end: float, *, map_y: bool = True
) -> collections.abc.Callable[[float], float]
Generate a control function from an ordinary mathematical function.
base
: base function, an ordinary mathematical functionstart
: the first value of the parameter of the base functionend
: the last value of the parameter of the base functionmap_y
: whether map the final return value to 1
linear ¶
Speed remains the same.
t
: the percentage of time
smooth ¶
Speed is slow first, then fast and then slow. (slow -> fast -> slow)
t
: the percentage of time
rebound ¶
Before the end, displacement will bounce off a bit.
t
: the percentage of time