After Effects Tutorial

Magnetic Text Effect

Create a magnetic distortion effect where Puppet Pins on a text layer are pulled toward a movable shape layer. Control the strength, range, and softness of the attraction with three simple sliders.

Layers Needed

Shape LayerMAGNET
Text LayerText 1 — pre-composed
Puppet PinsAdd pins to the parts of the text you want to deform.
Important: Pre-compose Text 1 before adding Puppet Pins. This gives you a clean layer to deform and makes the setup easier to manage.

Step-by-Step Setup

  1. Create the Magnet Layer

    Create a Shape Layer and rename it MAGNET.

    The layer's anchor point acts as the center of the magnetic attraction.

    After Effects composition showing the MAGNET shape layer next to the text.
    Create and position the MAGNET shape layer in the composition.
  2. Add Three Slider Controls

    Select the MAGNET layer and go to:

    Effect → Expression Controls → Slider Control

    Add three sliders and rename them:

    Slider Control in the After Effects Effects and Presets panel.
    Search for Slider Control under Expression Controls.
    Gravity, Radius, and Falloff slider controls applied to the MAGNET layer.
    Add three controls to the MAGNET layer and rename them Gravity, Radius, and Falloff.
    • Gravity — controls attraction strength
    • Radius — controls how far the effect reaches
    • Falloff — controls how smoothly the effect fades with distance
  3. Pre-compose the Text

    Create your text layer and rename it Text 1.

    Pre-compose the layer before applying Puppet Pins.

  4. Add Puppet Position Pins

    Select the pre-composed text layer and choose the Puppet Position Pin Tool.

    Place pins across the letters or word wherever you want the distortion to react.

    Text layer with multiple Puppet Position Pins placed across the letters.
    Add Puppet Position Pins across the text. Each pin can react independently to the magnet.
    Use more pins for finer deformation. For a simple word, one pin per letter or one pin around key intersections is often enough.
  5. Open a Puppet Pin Position

    Open the Text layer until you reach a Puppet Pin's Position property:

    Text 1
    └─ Puppet
       └─ Mesh 1
          └─ Deform
             └─ Puppet Pin 1
                └─ Position

    Alt-click the Position stopwatch to enable an expression.

    After Effects Puppet Pin Position property expanded in the timeline.
    Open each Puppet Pin's Position property and paste the expression there.
  6. Paste the Magnetic Expression

    Paste the following expression into the Puppet Pin Position property:

    magnet = thisComp.layer("MAGNET");
    
    gravity = magnet.effect("Gravity")("Slider");
    radius  = magnet.effect("Radius")("Slider");
    falloff = magnet.effect("Falloff")("Slider");
    
    magnetPos = magnet.toComp(magnet.anchorPoint);
    pinPos = thisLayer.toComp(value);
    
    d = length(pinPos, magnetPos);
    
    strength = 1 - clamp(d / radius, 0, 1);
    strength = Math.pow(strength, falloff);
    
    dir = magnetPos - pinPos;
    
    resultComp =
        pinPos +
        dir * strength * gravity / 100;
    
    thisLayer.fromComp(resultComp);
  7. Apply the Expression to Every Pin

    Copy the expression and paste it onto the Position property of every Puppet Pin you want the magnet to affect.

    Puppet Pin 1 → Position
    Puppet Pin 2 → Position
    Puppet Pin 3 → Position
    Puppet Pin 4 → Position

    Each pin measures its own distance from the Magnet layer, so nearby pins react more strongly than distant ones.

  8. Test the Effect

    Move the MAGNET layer around the composition.

    The Puppet Pins should now bend and pull toward it automatically.

Recommended Starting Values

ControlStarting ValueWhat It Does
Gravity50Controls how strongly the text is pulled toward the magnet.
Radius300Controls the distance of the magnetic influence.
Falloff2Controls how quickly the attraction becomes weaker with distance.

Soft, Wide Distortion

Gravity: 25
Radius: 500
Falloff: 2

Strong, Tight Distortion

Gravity: 80
Radius: 200
Falloff: 4

How the Expression Works

1. Find the Magnet Position

magnetPos = magnet.toComp(magnet.anchorPoint);

2. Find the Puppet Pin Position

pinPos = thisLayer.toComp(value);

3. Measure the Distance

d = length(pinPos, magnetPos);

4. Calculate the Influence

strength = 1 - clamp(d / radius, 0, 1);
strength = Math.pow(strength, falloff);

5. Pull the Pin Toward the Magnet

resultComp =
    pinPos +
    dir * strength * gravity / 100;

Download the Practice Project

Want to experiment with the setup instead of rebuilding it from scratch? Download the included After Effects project and test the MAGNET controls, Puppet Pins, and expression directly.

Kinetic Text — Magnetic Shape Practice File

After Effects project (.aep) included for hands-on experimentation.

Download .AEP
Tip: Duplicate the project before experimenting so you always have a clean original version to return to.

See the Effect in Action

These clips show how the Puppet Pins respond as the MAGNET layer moves around the text.

Quick sample: a compact preview of the magnetic distortion effect.
Full example: watch how the text deforms as the magnet passes through different areas of the word.

Final Result

You now have a reusable magnetic text distortion system. Animate or move the MAGNET layer around the composition and the text will dynamically react to it.

This technique works well for kinetic typography, logo animation, liquid-style text, interactive motion graphics, abstract transitions, title sequences, and experimental UI-style motion.