Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dynamic Letter Multiplier Issue

  • Dynamic Letter Multiplier Issue

    Posted by Othman Ahmed on November 12, 2025 at 9:46 pm

    Is it possible to dynamically add extra characters to text layers based on a slider control. As a jsx which should work on selected text layers and allow me to animate the effect over time.

    So the core effect will be: Add extra characters after specific letters in the text

    For example: If I have the text <strong style=”font-family: inherit; font-size: inherit;”>”hello world”:

    • At 0% slider: “hello world” (original text)
    • At 50% slider: “hellooo woorld” (adds some extra ‘o’s)
    • At 100% slider: “hellooooo wooooorld” (adds maximum extra ‘o’s)
    Othman Ahmed replied 6 months ago 1 Member · 1 Reply
  • 1 Reply
  • Othman Ahmed

    November 13, 2025 at 7:30 am

    I solved it with this expression:

    // Kashida (Tatweel) Removal Expression

    var originalText = “text here”;

    var kashidaChar = String.fromCharCode(0x0640); // Arabic Tatweel ـ

    // Get removal percentage from control layer

    var removePercent = 0;

    try {

    removePercent = thisComp.layer(“Kashida Control Layer”).effect(“Remove Kashida %”)(“Slider”);

    } catch (e) {

    removePercent = 0;

    }

    // Find all Kashida positions

    var kashidaPositions = [];

    for (var i = 0; i < originalText.length; i++) {

    if (originalText.charAt(i) === kashidaChar) {

    kashidaPositions.push(i);

    }

    }

    // Calculate how many Kashidas to remove

    var totalKashidas = kashidaPositions.length;

    var kashidasToRemove = Math.floor((removePercent / 100) * totalKashidas);

    // Build new text by removing Kashidas proportionally

    if (kashidasToRemove === 0) {

    originalText;

    } else if (kashidasToRemove >= totalKashidas) {

    originalText.split(kashidaChar).join(“”);

    } else {

    var newText = originalText;

    var removedCount = 0;

    for (var i = kashidaPositions.length – 1; i >= 0 && removedCount < kashidasToRemove; i–) {

    kashidaPositions[i] = -1;

    removedCount++;

    }

    var result = “”;

    var kashidaIndex = 0;

    for (var i = 0; i < originalText.length; i++) {

    if (originalText.charAt(i) === kashidaChar) {

    if (kashidaPositions[kashidaIndex] !== -1) {

    result += kashidaChar;

    }

    kashidaIndex++;

    } else {

    result += originalText.charAt(i);

    }

    }

    result;

    }

    It’s working good, But I’m wondering if there is a better simpler mechanism?!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy