mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 03:47:44 +00:00
Removed Logo from drawings
This commit is contained in:
parent
3821dd358a
commit
5a238f1551
1 changed files with 0 additions and 190 deletions
|
|
@ -667,196 +667,6 @@ class VectorizedEarth(SVGMobject):
|
|||
self.add_to_back(circle)
|
||||
|
||||
|
||||
class Logo(VMobject):
|
||||
CONFIG = {
|
||||
"pupil_radius": 1.0,
|
||||
"outer_radius": 2.0,
|
||||
"iris_background_blue": "#74C0E3",
|
||||
"iris_background_brown": "#8C6239",
|
||||
"blue_spike_colors": [
|
||||
"#528EA3",
|
||||
"#3E6576",
|
||||
"#224C5B",
|
||||
BLACK,
|
||||
],
|
||||
"brown_spike_colors": [
|
||||
"#754C24",
|
||||
"#603813",
|
||||
"#42210b",
|
||||
BLACK,
|
||||
],
|
||||
"n_spike_layers": 4,
|
||||
"n_spikes": 28,
|
||||
"spike_angle": TAU / 28,
|
||||
}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
VMobject.__init__(self, **kwargs)
|
||||
self.add_iris_back()
|
||||
self.add_spikes()
|
||||
self.add_pupil()
|
||||
|
||||
def add_iris_back(self):
|
||||
blue_iris_back = AnnularSector(
|
||||
inner_radius=self.pupil_radius,
|
||||
outer_radius=self.outer_radius,
|
||||
angle=270 * DEGREES,
|
||||
start_angle=180 * DEGREES,
|
||||
fill_color=self.iris_background_blue,
|
||||
fill_opacity=1,
|
||||
stroke_width=0,
|
||||
)
|
||||
brown_iris_back = AnnularSector(
|
||||
inner_radius=self.pupil_radius,
|
||||
outer_radius=self.outer_radius,
|
||||
angle=90 * DEGREES,
|
||||
start_angle=90 * DEGREES,
|
||||
fill_color=self.iris_background_brown,
|
||||
fill_opacity=1,
|
||||
stroke_width=0,
|
||||
)
|
||||
self.iris_background = VGroup(
|
||||
blue_iris_back,
|
||||
brown_iris_back,
|
||||
)
|
||||
self.add(self.iris_background)
|
||||
|
||||
def add_spikes(self):
|
||||
layers = VGroup()
|
||||
radii = np.linspace(
|
||||
self.outer_radius,
|
||||
self.pupil_radius,
|
||||
self.n_spike_layers,
|
||||
endpoint=False,
|
||||
)
|
||||
radii[:2] = radii[1::-1] # Swap first two
|
||||
if self.n_spike_layers > 2:
|
||||
radii[-1] = interpolate(
|
||||
radii[-1], self.pupil_radius, 0.25
|
||||
)
|
||||
|
||||
for radius in radii:
|
||||
tip_angle = self.spike_angle
|
||||
half_base = radius * np.tan(tip_angle)
|
||||
triangle, right_half_triangle = [
|
||||
Polygon(
|
||||
radius * UP,
|
||||
half_base * RIGHT,
|
||||
vertex3,
|
||||
fill_opacity=1,
|
||||
stroke_width=0,
|
||||
)
|
||||
for vertex3 in (half_base * LEFT, ORIGIN,)
|
||||
]
|
||||
left_half_triangle = right_half_triangle.copy()
|
||||
left_half_triangle.flip(UP, about_point=ORIGIN)
|
||||
|
||||
n_spikes = self.n_spikes
|
||||
full_spikes = [
|
||||
triangle.copy().rotate(
|
||||
-angle,
|
||||
about_point=ORIGIN
|
||||
)
|
||||
for angle in np.linspace(
|
||||
0, TAU, n_spikes, endpoint=False
|
||||
)
|
||||
]
|
||||
index = (3 * n_spikes) // 4
|
||||
if radius == radii[0]:
|
||||
layer = VGroup(*full_spikes)
|
||||
layer.rotate(
|
||||
-TAU / n_spikes / 2,
|
||||
about_point=ORIGIN
|
||||
)
|
||||
layer.brown_index = index
|
||||
else:
|
||||
half_spikes = [
|
||||
right_half_triangle.copy(),
|
||||
left_half_triangle.copy().rotate(
|
||||
90 * DEGREES, about_point=ORIGIN,
|
||||
),
|
||||
right_half_triangle.copy().rotate(
|
||||
90 * DEGREES, about_point=ORIGIN,
|
||||
),
|
||||
left_half_triangle.copy()
|
||||
]
|
||||
layer = VGroup(*it.chain(
|
||||
half_spikes[:1],
|
||||
full_spikes[1:index],
|
||||
half_spikes[1:3],
|
||||
full_spikes[index + 1:],
|
||||
half_spikes[3:],
|
||||
))
|
||||
layer.brown_index = index + 1
|
||||
|
||||
layers.add(layer)
|
||||
|
||||
# Color spikes
|
||||
blues = self.blue_spike_colors
|
||||
browns = self.brown_spike_colors
|
||||
for layer, blue, brown in zip(layers, blues, browns):
|
||||
index = layer.brown_index
|
||||
layer[:index].set_color(blue)
|
||||
layer[index:].set_color(brown)
|
||||
|
||||
self.spike_layers = layers
|
||||
self.add(layers)
|
||||
|
||||
def add_pupil(self):
|
||||
self.pupil = Circle(
|
||||
radius=self.pupil_radius,
|
||||
fill_color=BLACK,
|
||||
fill_opacity=1,
|
||||
stroke_width=0,
|
||||
sheen=0.0,
|
||||
)
|
||||
self.pupil.rotate(90 * DEGREES)
|
||||
self.add(self.pupil)
|
||||
|
||||
def cut_pupil(self):
|
||||
pupil = self.pupil
|
||||
center = pupil.get_center()
|
||||
new_pupil = VGroup(*[
|
||||
pupil.copy().pointwise_become_partial(pupil, a, b)
|
||||
for (a, b) in [(0.25, 1), (0, 0.25)]
|
||||
])
|
||||
for sector in new_pupil:
|
||||
sector.add_cubic_bezier_curve_to([
|
||||
sector.points[-1],
|
||||
*[center] * 3,
|
||||
*[sector.points[0]] * 2
|
||||
])
|
||||
self.remove(pupil)
|
||||
self.add(new_pupil)
|
||||
self.pupil = new_pupil
|
||||
|
||||
def get_blue_part_and_brown_part(self):
|
||||
if len(self.pupil) == 1:
|
||||
self.cut_pupil()
|
||||
# circle = Circle()
|
||||
# circle.set_stroke(width=0)
|
||||
# circle.set_fill(BLACK, opacity=1)
|
||||
# circle.match_width(self)
|
||||
# circle.move_to(self)
|
||||
blue_part = VGroup(
|
||||
self.iris_background[0],
|
||||
*[
|
||||
layer[:layer.brown_index]
|
||||
for layer in self.spike_layers
|
||||
],
|
||||
self.pupil[0],
|
||||
)
|
||||
brown_part = VGroup(
|
||||
self.iris_background[1],
|
||||
*[
|
||||
layer[layer.brown_index:]
|
||||
for layer in self.spike_layers
|
||||
],
|
||||
self.pupil[1],
|
||||
)
|
||||
return blue_part, brown_part
|
||||
|
||||
|
||||
# Cards
|
||||
class DeckOfCards(VGroup):
|
||||
def __init__(self, **kwargs):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue