2018-12-24 12:37:51 -08:00
|
|
|
from manimlib.animation.animation import Animation
|
2019-02-09 15:48:36 -08:00
|
|
|
from manimlib.constants import OUT
|
|
|
|
from manimlib.constants import PI
|
|
|
|
from manimlib.constants import TAU
|
2019-02-05 15:39:58 -08:00
|
|
|
from manimlib.utils.rate_functions import linear
|
2020-02-21 12:00:50 -08:00
|
|
|
from manimlib.utils.rate_functions import smooth
|
2018-03-31 15:11:35 -07:00
|
|
|
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2018-03-31 15:11:35 -07:00
|
|
|
class Rotating(Animation):
|
|
|
|
CONFIG = {
|
2020-02-21 12:00:50 -08:00
|
|
|
# "axis": OUT,
|
|
|
|
# "radians": TAU,
|
2018-04-06 13:58:59 -07:00
|
|
|
"run_time": 5,
|
2019-02-05 15:39:58 -08:00
|
|
|
"rate_func": linear,
|
2018-04-06 13:58:59 -07:00
|
|
|
"about_point": None,
|
|
|
|
"about_edge": None,
|
2020-02-21 12:00:50 -08:00
|
|
|
"suspend_mobject_updating": False,
|
2018-03-31 15:11:35 -07:00
|
|
|
}
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2020-02-21 12:00:50 -08:00
|
|
|
def __init__(self, mobject, angle=TAU, axis=OUT, **kwargs):
|
|
|
|
self.angle = angle
|
|
|
|
self.axis = axis
|
|
|
|
super().__init__(mobject, **kwargs)
|
|
|
|
|
2019-02-08 11:57:27 -08:00
|
|
|
def interpolate_mobject(self, alpha):
|
2020-02-21 12:00:50 -08:00
|
|
|
for sm1, sm2 in self.get_all_families_zipped():
|
|
|
|
sm1.points[:] = sm2.points
|
2018-03-31 15:11:35 -07:00
|
|
|
self.mobject.rotate(
|
2020-02-21 12:00:50 -08:00
|
|
|
alpha * self.angle,
|
2018-04-06 13:58:59 -07:00
|
|
|
axis=self.axis,
|
|
|
|
about_point=self.about_point,
|
|
|
|
about_edge=self.about_edge,
|
2018-03-31 15:11:35 -07:00
|
|
|
)
|
|
|
|
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2020-02-21 12:00:50 -08:00
|
|
|
class Rotate(Rotating):
|
2018-03-31 15:11:35 -07:00
|
|
|
CONFIG = {
|
2020-02-21 12:00:50 -08:00
|
|
|
"run_time": 1,
|
|
|
|
"rate_func": smooth,
|
2018-03-31 15:11:35 -07:00
|
|
|
}
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2019-02-09 15:48:36 -08:00
|
|
|
def __init__(self, mobject, angle=PI, axis=OUT, **kwargs):
|
2020-02-21 12:00:50 -08:00
|
|
|
super().__init__(mobject, angle, axis, **kwargs)
|