DnaHelix draws a double helix from the side, the first base of sequence at the left
(the other strand is its complement, complement(base)). Each turn is pitch pixels long and
ten base pairs; the strands twist spin turns a second, and the back of each strand is dimmer
than its front. With scan a reading light passes the pairs from delay, one every
step_time seconds, and writes the lit pair above and below the helix. From unzip_at
seconds the strands come apart from the left in unzip_time seconds and straighten, each half
of a pair staying with its strand; with replicate a new partner strand in new_color grows
along each of them behind the fork, its bases pairing with the old ones. The bases are
coloured by bases (BaseColors). Gallery scene: DnaHelix (it reads, then replicates).

DnaHelix 10 suse fframes_kit::prelude::*;use fframes_kit::kits::biology::complement;
let strand = "ATGC";assert_eq!(strand.chars().map(complement).collect::<String>(), "TACG");
fn replication<'a>(ui: &mut Ui<'a, '_, '_>) -> Svgr<'a> { ui.show(DnaHelix { sequence: "ATGCGTACCTGAATCGGATC".into(), unzip_at: Some(4.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).
DnaHelix
Section titled “DnaHelix”| Field | Type | Default | Description |
|---|---|---|---|
sequence |
String |
"ATGCGTACCTGAATCGGATCCATGCAGTTA".into() |
Bases read from the left, one pair per letter (A, T, G, C); the partner base is the complement. |
delay |
f32 |
0.0 |
Seconds after the container’s start before the scan and unzip timings begin. |
center |
(f64, f64) |
(0.0, 0.0) |
The middle of the helix, in units of ui.space. |
pitch |
f32 |
340.0 |
Pixels along the axis for one full turn (ten base pairs). |
radius |
f32 |
80.0 |
Pixels from the axis to each strand. |
spin |
f32 |
0.12 |
Twist of the helix, in turns per second. |
scan |
bool |
true |
A reading light passes along the pairs and writes the lit pair’s letters when true. |
step_time |
f32 |
0.18 |
Seconds the reading light spends on each pair. |
unzip_at |
Option<f32> |
None |
Seconds after delay when the strands start to come apart; None keeps the helix closed. |
unzip_time |
f32 |
3.0 |
Seconds the unzipping takes to travel from the left to the right end. |
replicate |
bool |
true |
A new partner strand grows along each separated strand behind the fork when true. |
bases |
BaseColors |
BaseColors::default() |
Colour of each base letter’s rung half. |
strand_color |
Color |
theme.colors.text |
Colour of the two backbones. |
new_color |
Color |
theme.colors.highlight |
Colour of the newly built strands while replicating. |
lit_color |
Color |
theme.colors.title |
Colour the pair under the reading light is mixed toward. |
letter_style |
TextStyle |
letter_style |
The font of the lit pair’s letters: 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
