ActionPotential traces the membrane potential of an action potential on axes of time (0 to
6 ms) against millivolts, drawing it in duration seconds from delay, a dot at its head.
The dashed threshold (-55 mV) and resting (-70 mV) lines are there from the start, and each
phase is named as the trace reaches it: resting potential, stimulus, depolarization, the peak,
repolarization and hyperpolarization. membrane_potential(ms) gives the curve. Gallery
scene: ActionPotential.

ActionPotential 7 suse fframes_kit::prelude::*;use fframes_kit::kits::biology::membrane_potential;
assert_eq!(membrane_potential(0.0), -70.0);assert!((membrane_potential(2.3) - 40.0).abs() < 1e-6); // the peak
fn spike<'a>(ui: &mut Ui<'a, '_, '_>) -> Svgr<'a> { ui.show(ActionPotential { duration: 3.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).
ActionPotential
Section titled “ActionPotential”| Field | Type | Default | Description |
|---|---|---|---|
delay |
f32 |
0.0 |
Seconds after the container’s start before the trace begins to draw. |
duration |
f32 |
5.0 |
Seconds the trace takes to draw from 0 to 6 ms. |
center |
(f64, f64) |
(0.0, -0.3) |
The middle of the axes, in units of ui.space. |
x_length |
f64 |
9.0 |
Width of the axes, in units of ui.space. |
y_length |
f64 |
5.2 |
Height of the axes, in units of ui.space. |
trace_color |
Color |
Color::hex("#ffd43b") |
Colour of the trace and the dot at its head. |
threshold_color |
Color |
Color::hex("#ff8787") |
Colour of the dashed threshold line (-55 mV). |
axis_color |
Color |
theme.colors.muted |
Colour of the axes and the dashed resting line (-70 mV). |
label_style |
TextStyle |
label_style |
The font of the axis labels and numbers: family, size in pixels and weight. |
phase_style |
TextStyle |
theme.typography.caption |
The font of the phase names along the trace: family, size in pixels and weight. |
text_color |
Color |
theme.colors.text |
Colour of the phase names. |
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
