Create Procedural North Star Shape (Expression-Based Geometry)

About This Expression

This expression procedurally generates a North Star–style shape using pure mathematical plotting. Instead of drawing a star manually, it calculates each point using trigonometry and connects them into a clean, scalable vector path.

The star is based on a 4-point geometry, alternating between an inner and outer radius to form sharp spikes. To create the iconic North Star look, the vertical points are deliberately extended, resulting in elongated top and bottom tails that feel celestial and radiant.

Because the shape is generated through code, it remains perfectly symmetrical, resolution-independent, and easy to modify.


How the Geometry Works

  • Points & Angles
    The loop runs through twice the number of points, alternating between inner and outer radii to create the star’s spikes.
  • Radius Switching
    Even-numbered points use the outer radius, while odd-numbered points use the inner radius, producing sharp star arms.
  • Vertical Emphasis
    The top and bottom points are multiplied by 1.5, stretching them vertically and giving the star its signature guiding-light appearance.
  • Vector Path Output
    All calculated points are passed into createPath(), resulting in a closed, editable vector shape.

Expression

innerRadius = 50;
outerRadius = 300;
points = 4;
pts = [];
for (i = 0; i < points * 2; i++) {
 angle = (i / (points * 2)) * Math.PI * 2;
 r = (i % 2 === 0) ? outerRadius : innerRadius;
 // Add elongated vertical tail for North Star look
 if (i === 0 || i === points) r *= 1.5;
 x = Math.cos(angle) * r;
 y = Math.sin(angle) * r;
 pts.push([x, y]);
}
createPath(pts, [], [], true);

How We Use This Expression

Step 1: Create a Shape Layer

  1. Open your composition in After Effects
  2. Go to Layer → New → Shape Layer
  3. Select the shape layer

This expression works on a shape path, not on a solid or text layer.


Step 2: Add a Path

  1. Twirl open the shape layer
  2. Go to Contents → Shape 1
  3. Click Add → Path

This creates a vector path that can be driven by an expression.


Step 3: Apply the Expression to the Path

  1. Twirl open Path 1
  2. Hold Alt (Windows) / Option (Mac) and click the Path stopwatch
  3. Paste the full North Star expression into the editor
  4. Click outside the editor to apply

The path will instantly form a symmetrical North Star shape.


Step 4: Center and Scale the Star

  • The star is generated from the shape layer’s center
  • Use Transform → Position to place it in your comp
  • Use Transform → Scale to resize it cleanly

Avoid editing the path points manually—let the expression control the geometry.


Step 5: Style the Star

You can now design the star visually:

  • Add Fill (white, gold, or gradient)
  • Add Stroke for sharp highlights
  • Apply Glow for a radiant look
  • Use Blur for soft sparkles

The expression controls the shape; effects control the appearance.


Step 6: Customize the Star Shape

Inside the expression, adjust:

  • innerRadius → sharp or soft points
  • outerRadius → star length
  • points → number of star arms
  • Vertical tail length by changing the 1.5 multiplier

Changes update instantly and stay perfectly symmetrical.


Step 7: Animate for Sparkle Effects

This expression is ideal for animation:

  • Rotate the shape for twinkle motion
  • Animate Scale for pulsing light
  • Animate Opacity for sparkle flashes

Because it’s vector-based, all motion stays crisp.


Step 8: Duplicate for Multiple Stars

To create constellations or sparkles:

  1. Duplicate the shape layer
  2. Move and scale each copy differently

Each star remains clean and consistent with no redrawing needed.


Best Use Cases in After Effects

  • North Star & celestial visuals
  • Sparkle and shine effects
  • Logo highlights
  • Magical or fantasy scenes
  • UI highlights and icons