# Cell

> Cell draws an animal or a plant cell (kind: CellKind::Animal or Plant), size pixels from its centre to its side.

Page: https://fframes-kit.pages.dev/docs/biology/cell/
Cargo feature: `biology` (`fframes-kit = { version = "..", features = ["biology"] }`)

`Cell` draws an animal or a plant cell (`kind: CellKind::Animal` or `Plant`), `size` pixels
from its centre to its side. From `delay` its `organelles` appear one every `stagger` seconds
in the order given; an empty list shows all of the kind's (`Organelle::of(kind)`): the
membrane, nucleus and nucleolus, rough ER, Golgi apparatus, mitochondria, lysosomes and free
ribosomes of an animal cell, and the cell wall, central vacuole and chloroplasts of a plant
cell as well. Each part fades in and grows into place; the membrane and the wall draw their
outline first. With `labels` a leader line then draws from each part to its name. The free
ribosomes are placed from `seed`, the colours come from `palette` (`CellPalette`). Gallery
scenes: `Cell` (an animal cell) and `PlantCell`.

Gallery clip of `Cell`: https://fframes-kit.pages.dev/media/scenes/Cell-3a582d6f.mp4

Gallery clip of `PlantCell`: https://fframes-kit.pages.dev/media/scenes/PlantCell-e9b757e1.mp4

```rust
use fframes_kit::prelude::*;

assert_eq!(Organelle::of(CellKind::Plant)[0], Organelle::CellWall);
assert_eq!(Organelle::Golgi.name(), "Golgi apparatus");

fn plant<'a>(ui: &mut Ui<'a, '_, '_>) -> Svgr<'a> {
    ui.show(Cell {
        kind: CellKind::Plant,
        // only these, in this order
        organelles: vec![Organelle::CellWall, Organelle::Vacuole, Organelle::Chloroplast],
        delay: 0.5,
        ..ui.defaults()
    })
}
```

## API

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`).

### Cell

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `kind` | `CellKind` | `CellKind::Animal` | Animal or plant cell: picks which organelles exist and the cell outline (rounded blob or walled rectangle). |
| `organelles` | `Vec<Organelle>` | `Vec::new()` | Organelles to show, in the order they appear; empty shows all of `kind`'s (`Organelle::of`). |
| `delay` | `f32` | `0.0` | Seconds after the container's start before the first organelle appears. |
| `stagger` | `f32` | `0.5` | Seconds between one organelle starting to appear and the next. |
| `center` | `(f64, f64)` | `(0.0, 0.0)` | The middle of the cell, in units of `ui.space`. |
| `size` | `f32` | `330.0` | Pixels from the cell's centre to its side (half the width). |
| `labels` | `bool` | `true` | Draws a leader line and name for each organelle when `true`; `false` for the bare cell. |
| `seed` | `u64` | `7` | Seed for the random placement of the free ribosomes; the same seed gives the same dots. |
| `palette` | `CellPalette` | `CellPalette::default()` | Colours of the cytoplasm, membrane and each organelle. |
| `leader_color` | `Color` | `theme.colors.muted` | Colour of the leader lines. |
| `label_color` | `Color` | `theme.colors.text` | Colour of the organelle names. |
| `label_style` | `TextStyle` | `theme.typography.caption` | The font of the organelle names: family, size in pixels and weight. |
| `enter` | `Option<FadeIn>` | `None` | Fade in at the start; `None` for none. |
| `exit` | `Option<FadeOut>` | `None` | Fade out before the end; `None` for none. |

Feature `biology` · [Source](https://github.com/khanhthanhdev/fframes-kit/blob/main/fframes-kit/src/kits/biology/cell.rs#L585)
