objects¶
- class AdS_Jc[source]¶
Represent vacuum discussions for Randall-Sundrum (RS) and Dark Bubble (DB) models.
This class visualizes the brane-vacuum system with arrows to illustrate normal orientation changes across the brane. It includes animations for demonstrating Z₂ symmetry (RS case) and normal vector behavior in both models. The arrow element is always the last (
[-1]) entry in the group.- Parameters:
vacua_type (str) – Type of vacuum configuration. Options: -
"RS": Randall-Sundrum model with Z₂ symmetry. -"DB": Dark Bubble model with asymmetric vacua. Default is"DB".arrow_color (ParsableManimColor) – Color of the normal vector arrow. Default is
WHITE.kwargs – Additional keyword arguments passed to
Vacuum_General,Brane_General, andVGroup.
Note
See
Vacuum_GeneralandBrane_Generalfor additional inherited parameters related to vacuum and brane appearance.Example usage:
from manim import * from manim_string_cosmo import AdS_Jc class Example_AdS_Jc(Scene): def construct(self): show_db = AdS_Jc(vacua_type="DB") show_rs = AdS_Jc(vacua_type="RS") show = VGroup(show_db, show_rs).arrange(RIGHT, aligned_edge=DOWN, buff=0.2) show.scale_to_fit_width(config.frame_width-2) self.play(AnimationGroup(*[x.fade_in() for x in show])) self.play(AnimationGroup(*[x.fade_in_arrow() for x in show])) self.play(show[1].show_symmetry(rt=5)) self.play(show[1].restore_symmetry()) self.play(AnimationGroup(show[0].show_n_vector_db(rt=5), show[1].show_n_vector_rs(rt=5))) self.play(show.animate.shift(2*UP)) self.play(FadeOut(show))
- fade_in(rt: float = 1, rf: float = <function linear>) Animation[source]¶
Fade in the vacuum-brane system without the arrow.
This method overrides the default
FadeInanimation to prevent scaling issues when adding elements to a group after initialization.- Parameters:
rt (float) – Run time of the animation. Default is
1.rf (function) – Rate function controlling animation timing. Default is
linear.
- Returns:
FadeIn animation of all group elements except the arrow.
- Return type:
Animation
- fade_in_arrow(rt: float = 2, rf: float = <function linear>) Animation[source]¶
Fade in the normal vector arrow.
- Parameters:
rt (float) – Run time of the animation. Default is
2.rf (function) – Rate function controlling animation timing. Default is
linear.
- Returns:
FadeIn animation of the arrow element.
- Return type:
Animation
- restore_symmetry(rt: float = 2, rf=<function linear>) Succession[source]¶
Restore the original vacuum configuration after symmetry demonstration.
- Parameters:
rt (float) – Run time of the animation. Default is
2.rf (function) – Rate function controlling animation timing. Default is
linear.
- Returns:
Animation restoring the unfolded configuration.
- Return type:
Succession
- show_n_vector_db(rt: float = 2, rf=<function linear>) Succession[source]¶
Show the behavior of the normal vector across vacua in the DB model.
Demonstrates how the normal vector maintains consistent orientation in the Dark Bubble model where vacua have distinct properties.
- Parameters:
rt (float) – Run time of the animation. Default is
2.rf (function) – Rate function controlling animation timing. Default is
linear.
- Returns:
Animation showing normal vector behavior in asymmetric vacua.
- Return type:
Succession
- show_n_vector_rs(rt: float = 2, rf=<function linear>) Succession[source]¶
Show the behavior of the normal vector across vacua in the RS model.
Demonstrates how the normal vector changes orientation when crossing the brane in the Randall-Sundrum scenario with Z₂ symmetry.
- Parameters:
rt (float) – Run time of the animation. Default is
2.rf (function) – Rate function controlling animation timing. Default is
linear.
- Returns:
Animation showing normal vector evolution across the brane.
- Return type:
Succession
- show_symmetry(rt: float = 2, rf=<function linear>) Succession[source]¶
Demonstrate Z₂ symmetry by folding the outside vacuum.
This animation removes the outside vacuum and rotates the inside vacuum about the brane to simulate the Z₂ symmetry operation.
- Parameters:
rt (float) – Run time of the animation. Default is
2.rf (function) – Rate function controlling animation timing. Default is
linear.
- Returns:
Animation showing Z₂ symmetry folding.
- Return type:
Succession
Note
This method only works with RS-type (
vacua_type="RS"). The Dark Bubble model has distinct inside and outside vacua without this symmetry.
- class Black_Hole[source]¶
Create a black hole group that can potentially emit a brane.
This class visualizes different types of black holes in string cosmology, including fragmentation scenarios (AdS fragmentation à la Maldacena) and spinning black holes. The expanding bubble is always the last (
[-1]) element of the object.- Parameters:
bh_size (float) – Size (radius) of the black hole. Default is
brane_radiusfromBrane_General(typically 1).bh_color (ParsableManimColor) – Color of the black hole. Default is
BLACK.bh_fill_opa (float) – Fill opacity of the black hole. Default is
0.8.bh_type (str) – Type of black hole visualization. Options: -
"fragmentation": Shows Q > T text, representing brane nucleation via AdS fragmentation. -"spinning": Shows theta and mu parameters for a rotating black hole. -"none": Empty black hole without text labels. Default is"none".kwargs – Additional keyword arguments passed to
Brane_GeneralandVGroup.
Note
The expanding bubble (brane) is always accessible as the last element (
[-1]) of the object. SeeBrane_Generalfor additional inherited parameters.Example usage:
from manim import * from manim_string_cosmo import Black_Hole class Example_Black_Hole(Scene): def construct(self): bh_sp = Black_Hole(bh_type="spinning") bh_frag = Black_Hole(bh_type="fragmentation") bh = Black_Hole() bh_group = VGroup(bh_sp, bh_frag, bh).arrange(RIGHT, buff=3) bh_group.scale_to_fit_width(config.frame_width-1) self.add(bh_group) self.play(AnimationGroup(*[x.nucleate() for x in bh_group])) self.play(AnimationGroup(*[x.expand() for x in bh_group]))
- expand(rt: float = 3, rf: float = <function linear>, scaling: float = 2.5) Animation[source]¶
Animate the expansion of the nucleated brane.
For spinning black holes (
bh_type="spinning"), this also animates the theta parameter moving along its circular path.- Parameters:
rt (float) – Run time of the animation. Default is
3.rf (function) – Rate function controlling animation timing. Default is
linear.scaling (float) – Scaling factor for the brane expansion. Default is
2.5.
- Returns:
Animation showing brane expansion. For spinning type, includes theta motion.
- Return type:
AnimationGroup
- nucleate(rt: float = 0.5, rf: float = <function linear>, scaling: float = 1.1) Animation[source]¶
Animate the nucleation of a brane through the black hole horizon.
- Parameters:
rt (float) – Run time of the animation. Default is
0.5.rf (function) – Rate function controlling animation timing. Default is
linear.scaling (float) – Scaling factor for the brane during nucleation. Default is
1.1.
- Returns:
Animation showing brane nucleation through the horizon.
- Return type:
AnimationGroup
- class Brane_General[source]¶
Base class providing common initialization parameters for brane objects.
This is a mock-up class to centralize all input parameters related to branes and associated objects, including color, size, opacity, and stroke properties.
- Parameters:
brane_color (ParsableManimColor) – Filling color of the brane. Default is
RED.brane_radius (float) – Initial size (radius) of the brane. Default is
1.brane_fill_opa (float) – Fill opacity of the brane. Note that fill opacity may vary when representing different AdS scales. Default is
0.1.brane_stroke_w (float) – Stroke width of the brane border. Default is
0.2.brane_text_color (ParsableManimColor) – Color of text elements associated with the brane. Default is
WHITE.kwargs – Additional keyword arguments passed to
VGroup.
Note
This class is designed to be inherited by other brane-related classes to ensure consistent parameter handling across different brane representations.
- class Bubble[source]¶
Represent Dark Bubble scenarios in 2D with various physical configurations.
This class visualizes bubble nucleation and expansion in string cosmology, supporting multiple physical scenarios including empty vacuum, radiation content, electromagnetic fields, strings, gravitational waves, and energy conservation discussions. The bubble (brane) is always the 3rd element (index
[2]) of the group.- Parameters:
bubble_type (str) – Type of bubble configuration. Options: -
"empty": Standard inside/outside configuration with AdS scales k− and k₊. -"instanton": AdS scales replaced by scalar potentials V(φ−) and V(φ₊). -"radiation": Includes matter (mass) inside the bubble. -"strings": Shows radially stretching strings from brane to bulk boundary. -"GW": Displays gravitational wave emission from the brane. -"em": Visualizes electromagnetic B-field on the brane with glow effect. -"energy_discussion": Shows energy bar for discussing energy conservation. Default is"empty".box_height (float) – Height of the vacuum background box. Default is
6.box_width (float) – Width of the vacuum background box. Default is
8.string_color (ParsableManimColor) – Color of the strings (for
bubble_type="strings"). Default isBLUE.string_stroke_w (float) – Stroke width of the strings. Default is
1.5.field_gradient (float) – Number of gradient layers for the electromagnetic field glow effect. Higher values create smoother gradients. Default is
50.field_top_color (ParsableManimColor) – Color of the electromagnetic field on the brane surface. Default is
BLUE.field_bulk_color (ParsableManimColor) – Color for bulk electromagnetic field (to be implemented). Default is
PINK.kwargs – Additional keyword arguments passed to
Brane_General,Vacuum_General, andGroup.
Note
The bubble (brane) is always the 3rd element (
[2]) in the internalbubblegroup. SeeBrane_GeneralandVacuum_Generalfor additional inherited parameters.Attention
The
"em"mode currently lacks representation of the B-field in the bulk; only the brane surface field is visualized.Example usage:
from manim import * from manim_string_cosmo import Bubble class Example_Bubble(Scene): def construct(self): bubble_types = ["empty", "radiation", "em", "strings", "GW"] bubble_group = Group(*[Bubble(bubble_type=style).scale(0.4) for style in bubble_types]) bubble_group.arrange_in_grid(2, 3) self.play(AnimationGroup(*[x.fade_in_bulk() for x in bubble_group])) self.play(AnimationGroup(*[x.create_bubble() for x in bubble_group])) self.play(AnimationGroup(*[x.expand_bubble() for x in bubble_group])) class Example_Energy_Discussion(Scene): def construct(self): bub = Bubble(bubble_type="energy_discussion").scale(0.8) self.play(bub.fade_in_bulk()) self.play(bub.fail_creation()) self.play(bub.create_bubble()) self.play(bub.expand_bubble()) self.play(FadeOut(bub))
- create_bubble(rt: float = 0.2, rf: float = <function linear>) Succession[source]¶
Animate bubble nucleation and display inside vacuum label.
The animation behavior varies by bubble type: -
"energy_discussion": Shows energy bar reaching threshold and successful nucleation. -"em": Creates brane with electromagnetic field visualization. -"strings": Creates brane and attached strings. -"radiation": Creates brane and shows interior matter. - Other types: Standard brane creation with inside text.- Parameters:
rt (float) – Run time of the animation. Default is
0.2.rf (function) – Rate function controlling animation timing. Default is
linear.
- Returns:
Animation sequence for bubble creation with type-specific elements.
- Return type:
Succession
- expand_bubble(rt: float = 6, rf: float = <function linear>, sca: float = 2.5) AnimationGroup[source]¶
Animate bubble expansion with type-specific physical effects.
The expansion animation varies by bubble type: -
"energy_discussion": Shows energy transfer from bar to expanding bubble. -"GW": Displays gravitational wave emission during expansion. -"em": Expands brane with electromagnetic field. -"strings": Stretches strings radially as brane expands. - Other types: Standard brane scaling.- Parameters:
rt (float) – Run time of the animation. Default is
6.rf (function) – Rate function controlling animation timing. Default is
linear.sca (float) – Scaling factor for bubble expansion. Default is
2.5.
- Returns:
Animation showing bubble expansion with physical effects.
- Return type:
AnimationGroup or Succession
- fade_in_bulk(rt: float = 1, rf: float = <function linear>) Animation[source]¶
Fade in the bulk vacuum and outside cosmological constant label.
For
bubble_type="energy_discussion", this also creates the energy bar visualization at the bottom of the scene.- Parameters:
rt (float) – Run time of the animation. Default is
1.rf (function) – Rate function controlling animation timing. Default is
linear.
- Returns:
Animation showing bulk box and outside text appearance.
- Return type:
Animation or Succession
- fail_creation(rt: float = 3, rf: float = <function there_and_back_with_pause>) AnimationGroup[source]¶
Demonstrate failed bubble nucleation due to insufficient energy.
The brane attempts to nucleate but fails because the energy bar shows insufficient energy available for bubble creation.
- Parameters:
rt (float) – Run time of the animation. Default is
3.rf (function) – Rate function controlling animation timing. Default is
there_and_back_with_pause.
- Returns:
Animation showing energy accumulation and failed nucleation attempt.
- Return type:
AnimationGroup
Note
This method only works with
bubble_type="energy_discussion".
- show_radius(rt: float = 1, rf: float = <function linear>) Succession[source]¶
Display the time-dependent radius label r = a(τ) for the bubble.
- Parameters:
rt (float) – Run time of the animation. Default is
1.rf (function) – Rate function controlling animation timing. Default is
linear.
- Returns:
Animation showing radius line and time-dependent label.
- Return type:
Succession
- class Vacuum_General[source]¶
Base class providing common initialization parameters for vacuum objects.
This class centralizes all input parameters related to the color, shape, and appearance of vacuum representations in string cosmology visualizations.
- Parameters:
vacuum_color (ParsableManimColor) – Color of the vacuum representation. Default is
RED.vacuum_fill_opa (float) – Fill opacity of the vacuum. Default is
0.2.vacuum_stroke_w (float) – Stroke width of the vacuum border. Default is
0.2.vacuum_text_color (ParsableManimColor) – Color of text elements associated with the vacuum. Default is
WHITE.corner_rad (float) – Corner radius of the surrounding box. Default is
0.corner_rad_direction (list[int]) – List of four integers controlling which corners of the surrounding rectangle get rounded: [top-left, top-right, bottom-right, bottom-left]. Default is
[0, 0, 0, 0].kwargs – Additional keyword arguments passed to
VGroup.
Note
This class is designed to be inherited by other vacuum-related classes to ensure consistent parameter handling across different vacuum representations.