maliang.animation.animations¶
字数 9 个 阅读时间不到 1 分钟 访问量
源代码:maliang/animation/animations.py
Base and standard animation classes.
The animation base class can be inherited or called directly. Other standard animation classes are best used by direct calls, rather than inheritance.
类:
-
Animation–Base animation class.
-
MoveWindow–Animation of moving the window.
-
MoveTkWidget–Animation of moving
tkinter.Widget. -
MoveWidget–Animation of moving
virtual.Widget. -
MoveElement–Animation of moving
virtual.Element. -
MoveItem–Animation of moving a item of
tkinter.Canvas. -
GradientTkWidget–Animation of making the color of
tkinter.Widgetto be gradient. -
GradientItem–Animation of making the color of canvas item to be gradient.
-
ScaleFontSize–Animation of scaling the font size of
virtual.Text.
Animation ¶
Animation(
duration: int,
command: collections.abc.Callable[[float], typing.Any],
*,
controller: collections.abc.Callable[[float], float] = controllers.linear,
end: collections.abc.Callable[[], typing.Any] | None = None,
fps: int = 30,
repeat: int = 0,
repeat_delay: int = 0,
derivation: bool = False
)
Base animation class.
duration: duration of the animation, in millisecondscommand: callback function, which will be called once per framecontroller: a function that controls the animation processend: end function, which is called once at the end of the animationfps: frame rate of the animationrepeat: number of repetitions of the animationrepeat_delay: length of the delay before the animation repeatsderivation: whether the callback function is derivative
方法:
属性:
MoveWindow ¶
MoveWindow(
window: tkinter.Tk | tkinter.Toplevel | containers.Tk | containers.Toplevel,
offset: tuple[float, float],
duration: int,
*,
controller: collections.abc.Callable[[float], float] = controllers.linear,
end: collections.abc.Callable[[], typing.Any] | None = None,
fps: int = 30,
repeat: int = 0,
repeat_delay: int = 0
)
Bases: Animation
Animation of moving the window.
window: the window to be movedoffset: relative offset of the coordinatesduration: duration of the animation, in millisecondscontroller: a function that controls the animation processend: end function, which is called once at the end of the animationfps: frame rate of the animationrepeat: number of repetitions of the animationrepeat_delay: length of the delay before the animation repeats
MoveTkWidget ¶
MoveTkWidget(
widget: tkinter.Widget,
offset: tuple[float, float],
duration: int,
*,
controller: collections.abc.Callable[[float], float] = controllers.linear,
end: collections.abc.Callable[[], typing.Any] | None = None,
fps: int = 30,
repeat: int = 0,
repeat_delay: int = 0
)
Bases: Animation
Animation of moving tkinter.Widget.
widget: thetkinter.Widgetto be movedoffset: relative offset of the coordinatesduration: duration of the animation, in millisecondscontroller: a function that controls the animation processend: end function, which is called once at the end of the animationfps: frame rate of the animationrepeat: number of repetitions of the animationrepeat_delay: length of the delay before the animation repeats
MoveWidget ¶
MoveWidget(
widget: virtual.Widget,
offset: tuple[float, float],
duration: int,
*,
controller: collections.abc.Callable[[float], float] = controllers.linear,
end: collections.abc.Callable[[], typing.Any] | None = None,
fps: int = 30,
repeat: int = 0,
repeat_delay: int = 0
)
Bases: Animation
Animation of moving virtual.Widget.
widget: thevirtual.Widgetto be movedoffset: relative offset of the coordinatesduration: duration of the animation, in millisecondscontroller: a function that controls the animation processend: end function, which is called once at the end of the animationfps: frame rate of the animationrepeat: number of repetitions of the animationrepeat_delay: length of the delay before the animation repeats
MoveElement ¶
MoveElement(
element: virtual.Element,
offset: tuple[float, float],
duration: int,
*,
controller: collections.abc.Callable[[float], float] = controllers.linear,
end: collections.abc.Callable[[], typing.Any] | None = None,
fps: int = 30,
repeat: int = 0,
repeat_delay: int = 0
)
Bases: Animation
Animation of moving virtual.Element.
element: thevirtual.Elementto be movedoffset: relative offset of the coordinatesduration: duration of the animation, in millisecondscontroller: a function that controls the animation processend: end function, which is called once at the end of the animationfps: frame rate of the animationrepeat: number of repetitions of the animationrepeat_delay: length of the delay before the animation repeats
MoveItem ¶
MoveItem(
canvas: tkinter.Canvas | containers.Canvas,
item: int,
offset: tuple[float, float],
duration: int,
*,
controller: collections.abc.Callable[[float], float] = controllers.linear,
end: collections.abc.Callable[[], typing.Any] | None = None,
fps: int = 30,
repeat: int = 0,
repeat_delay: int = 0
)
Bases: Animation
Animation of moving a item of tkinter.Canvas.
canvas: an instance oftkinter.Canvasthat contains the itemitem: the item to be movedoffset: relative offset of the coordinatesduration: duration of the animation, in millisecondscontroller: a function that controls the animation processend: end function, which is called once at the end of the animationfps: frame rate of the animationrepeat: number of repetitions of the animationrepeat_delay: length of the delay before the animation repeats
GradientTkWidget ¶
GradientTkWidget(
widget: tkinter.Widget,
parameter: str,
colors: tuple[str, str],
duration: int,
*,
controller: collections.abc.Callable[[float], float] = controllers.linear,
end: collections.abc.Callable[[], typing.Any] | None = None,
fps: int = 30,
repeat: int = 0,
repeat_delay: int = 0,
derivation: bool = False
)
Bases: Animation
Animation of making the color of tkinter.Widget to be gradient.
widget: thetkinter.Widgetwhose color is to be gradientparameter: parameter name of widget that is to be modified in colorcolors: a tuple of the initial and ending colorsduration: duration of the animation, in millisecondscontroller: a function that controls the animation processend: end function, which is called once at the end of the animationfps: frame rate of the animationrepeat: number of repetitions of the animationrepeat_delay: length of the delay before the animation repeatsderivation: whether the callback function is derivative
GradientItem ¶
GradientItem(
canvas: tkinter.Canvas | containers.Canvas,
item: int,
parameter: str,
colors: tuple[str, str],
duration: int,
*,
controller: collections.abc.Callable[[float], float] = controllers.linear,
end: collections.abc.Callable[[], typing.Any] | None = None,
fps: int = 30,
repeat: int = 0,
repeat_delay: int = 0,
derivation: bool = False
)
Bases: Animation
Animation of making the color of canvas item to be gradient.
canvas: an instance oftkinter.Canvasthat contains the itemitem: item whose color is to be gradientparameter: parameter name of item that is to be modified in colorcolors: a tuple of the initial and ending colorsduration: duration of the animation, in millisecondscontroller: a function that controls the animation processend: end function, which is called once at the end of the animationfps: frame rate of the animationrepeat: number of repetitions of the animationrepeat_delay: length of the delay before the animation repeatsderivation: whether the callback function is derivative
ScaleFontSize ¶
ScaleFontSize(
text: virtual.Text,
sizes: float | tuple[float, float],
duration: int,
*,
controller: collections.abc.Callable[[float], float] = controllers.linear,
end: collections.abc.Callable[[], typing.Any] | None = None,
fps: int = 30,
repeat: int = 0,
repeat_delay: int = 0,
derivation: bool = False
)
Bases: Animation
Animation of scaling the font size of virtual.Text.
text: an instance ofvirtual.Textthat needs to be scaledsizes: a tuple of the initial and ending sizes or target font sizeduration: duration of the animation, in millisecondscontroller: a function that controls the animation processend: end function, which is called once at the end of the animationfps: frame rate of the animationrepeat: number of repetitions of the animationrepeat_delay: length of the delay before the animation repeatsderivation: whether the callback function is derivative