Skip to content

MitosisStages

Cargo featurefeatures = ["biology"]

MitosisStages shows one cell dividing into two, size pixels from its centre to its side. From delay it goes through the six stages of MitosisStage::ALL, each stage_time seconds long, and names each one above the cell (label):

  • Interphase: the chromosomes lie loose and thin in the nucleus (seed places them).
  • Prophase: they condense into X-shaped pairs of sister chromatids, the nuclear envelope breaks down and the centrosomes move to the poles.
  • Metaphase: spindle fibres line them up across the middle.
  • Anaphase: the sisters are pulled to opposite poles and the cell stretches.
  • Telophase: a nucleus forms around each group and the chromosomes loosen.
  • Cytokinesis: the cell pinches into two.

Chromosomes come in homologous pairs of one length, one of each pair coloured from each parent (colors). stage_at(seconds) says which stage shows at a time. Gallery scene: MitosisStages.

MitosisStages demo, first frame
MitosisStages 11 s
use fframes_kit::prelude::*;
let figure = MitosisStages { delay: 1.0, stage_time: 2.0, ..MitosisStages::default() };
assert_eq!(figure.stage_at(4.0), MitosisStage::Prophase);
assert_eq!(MitosisStage::ALL[5].name(), "Cytokinesis");
fn division<'a>(ui: &mut Ui<'a, '_, '_>) -> Svgr<'a> {
ui.show(MitosisStages {
chromosomes: 6,
stage_time: 2.0,
..ui.defaults()
})
}

Components are plain structs. Set the fields you need and fill the rest with ..ui.defaults(): the defaults below come from the current theme (theme. values are fields of Theme).

Field Type Default Description
delay f32 0.0 Seconds after the container’s start before interphase begins.
stage_time f32 1.6 Seconds each stage lasts.
center (f64, f64) (0.0, -0.3) The middle of the cell, in units of ui.space.
size f32 300.0 Pixels from the cell’s centre to its side (half the width).
chromosomes usize 4 Number of chromosomes in the cell; they come in homologous pairs of one length.
arm f32 30.0 Pixels of the longest chromatid arm; the other pairs are shorter.
colors Vec<Color> vec![Color::hex("#ff8787"), Color::hex("#74c0fc")] Colours of the chromosomes by parent, alternating along the list; empty uses the palette’s membrane colour.
seed u64 3 Seed for where the chromosomes lie loose in interphase; the same seed gives the same layout.
palette CellPalette CellPalette::default() Colours of the cytoplasm, membrane, nucleus and the other cell parts.
spindle_color Color Color::hex("#ced4da") Colour of the spindle fibres, asters and centrosomes.
label bool true Names the current stage above the cell when true.
label_style TextStyle theme.typography.body The font of the stage name: family, size in pixels and weight.
label_color Color theme.colors.text Colour of the stage name.
enter Option<FadeIn> None Fade in at the start; None for none.
exit Option<FadeOut> None Fade out before the end; None for none.

Methods:

  • fn stage_at(&self, seconds: f32) -> MitosisStage: The stage shown seconds into the video.

Feature biology · Source