Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Light Sweep Effect Boundaries.

  • Light Sweep Effect Boundaries.

    Posted by Jace Bradley on January 17, 2023 at 10:10 pm

    Hi wonderful people.

    I am trying to create a script to animate the Center Property for the CC Light Sweep Effect so it will animate from left to right but based on layer boundaries. I tried to just add normal keyframes but that doesn’t work.

    this is the code :

    myButton2.onClick = function() {

    app.beginUndoGroup(“UNDO SWEEP”);

    var activeComp = app.project.activeItem;

    if (!(activeComp instanceof CompItem)) {

    alert(“Please select a layer in the active composition.”);

    return;

    }

    // Get the selected layers

    var selectedLayers = activeComp.selectedLayers;

    if (selectedLayers.length == 0) {

    alert(“Please select at least one layer.”);

    return;

    }

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

    var currentLayer = selectedLayers[i];

    // Add the Light Sweep effect to the layer

    currentLayer.property(“Effects”).addProperty(“CC Light Sweep”);

    // Get the layer boundaries

    var left = currentLayer.sourceRectAtTime(0, false).left;

    var right = currentLayer.sourceRectAtTime(0, false).right;

    // Set the current time indicator as the starting point for the animation

    var currentTime = activeComp.time;

    // Get the “center” property of the effect

    var center = currentLayer.property(“Effects”).property(“CC Light Sweep”).property(“Center”);

    // Animate the “center” property from left to right over a duration of one second

    center.setValueAtTime(currentTime, [left, 0]);

    center.setValueAtTime(currentTime + 1, [right, 0]);

    center.setInterpolationTypeAtKey(1,KeyframeInterpolationType.BEZIER, KeyframeInterpolationType.BEZIER);

    }

    app.endUndoGroup();

    }

    // Show the UI panel

    myPanel.show();

    That is setting two keyframes but is not animating at all 🙁

    Thank you in Advance.

    Jace Bradley replied 3 years, 4 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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