View all expressions
Motion

Animated 2D DNA Helix Path

Creates an animated 2D DNA strand path (one strand per layer) with controls for helix height, turns, radius, depth, offset, segments, and rotation speed. The path updates in real time and simulates subtle pseudo-3D depth. To build a full double helix, duplicate the layer and set the second strand’s offset to 180.

Contributed by:


// DNA Helix – Apply to Path (one strand per layer)
// Controls
helixHeight = effect("Helix Height")("Slider")
// vertical length
turns = effect("Turns")("Slider");
// number of spiral turns
offset = effect("Offset")("Slider") * Math.PI / 180;
// horizontal strand
offsetspeed = effect("Speed")("Slider") * Math.PI / 180;
// rotation speed
radius = effect("Radius")("Slider");
// helix thickness
depth = effect("Depth")("Slider");
// pseudo-3D depth
segments = effect("Segments")("Slider");
// resolution (optional slider)
// Pre-calcpts = [];
inT = [];
outT = [];
for (i = 0; i <= segments; i++) {
t = i / segments;
// Helix movement
angle = t * turns * 2 * Math.PI + offset + time * speed;
x = Math.cos(angle) * radius;
y = -helixHeight/2 + t * helixHeight;
z = Math.sin(angle) * radius;
// Pseudo 3D projection
pts.push([x + z * depth, y]);
// Curved path smoothing
nextAngle = angle + (2 * Math.PI / segments);
tx = Math.cos(nextAngle) * radius;
ty = helixHeight / segments * 0.5;
inT.push([-tx, -ty]);
outT.push([tx, ty]);
}
createPath(pts, inT, outT, false);

Animated 2D DNA Helix Path

Practical use case

Build science explainers or medical visuals by layering two customizable animated DNA strands in After Effects.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image