Forum Replies Created

Page 9 of 13
  • Thanks for the reply Tomas!

    Yeah I don’t think I’m on the right track with propertyValueType I’m starting to think that I should maybe use value.length instead.

    I actually managed to do it in the expression editor in after effects with:

    var p = thisComp.layer("Orange Solid 1").transform.position;
    var numVal = p.value.length;
    if(!numVal){
    1;
    }else{
    p.value.length;
    };

    When there was only one value, it returned nothing that my reasoning behind the if(!numVal).

    But can’t get it to work in the script.

  • Yoan Boisjoli

    March 23, 2023 at 7:22 pm in reply to: Undo group problem

    Hmm.. Looks like we think alike!

    Maybe a better approach is to create a temporary layer on the first onChanging event and then update it during the subsequent onChanging events. This way, you only need to create one undo group when applying the effect in the onChange event.

    var previewLayer = null;

    function createPreviewLayer() {

    // Create your temporary shape layer here and set its outPoint

    // based on the slider value.

    // Return the created layer.

    }

    function updatePreviewLayer() {

    // Update the outPoint of the previewLayer based on the slider value.

    }

    slider1.onChanging = function() {

    if (!previewLayer) {

    previewLayer = createPreviewLayer();

    } else {

    updatePreviewLayer();

    }

    }

    slider1.onChange = function() {

    // Clean up the preview layer before applying the effect.

    previewLayer.remove();

    app.beginUndoGroup("Apply Effect");

    // Adjust the selection and apply the effect based on the final slider value.

    app.endUndoGroup();

    // Reset the preview layer.

    previewLayer = null;

    }

    This creates a temporary preview layer and updates it during slider adjustments. When the user releases the slider, the temporary layer is removed, and the effect is applied within a clean undo group. Hope this will give you the desired undo behavior without any warning pop-ups.

  • Yoan Boisjoli

    March 23, 2023 at 1:23 am in reply to: Undo group problem

    Hi Edward! I’m not a pro with scripts but I think that instead of starting an undo group on onChanging and closing it on onChange, you can use the app.beginUndoGroup() and app.endUndoGroup() methods to manually start and end an undo group at the appropriate times.

    Here’s an example implementation:

    var undoGroupInProgress = false;

    slider1.onChanging = function() {

    if (!undoGroupInProgress) {

    app.beginUndoGroup("Preview Slider Change");

    undoGroupInProgress = true;

    }

    // create shape layer to preview (adjust outPoint on the shape layer)

    }

    slider1.onChange = function() {

    // apply the effect

    if (undoGroupInProgress) {

    app.endUndoGroup();

    undoGroupInProgress = false;

    }

    }

    With this implementation, the undo group is only started once when the slider is first changed, and is ended once when the slider is released. The undoGroupInProgress variable is used to ensure that the undo group is only closed if it was actually opened in the first place.

    This should avoid the “undo mismatch” warning and provide a clean undo history for your users.

    Hope this helps/work for you.

  • Yoan Boisjoli

    March 21, 2023 at 10:03 am in reply to: MOGRT make selected words in italics

    Hi Sarah! Thanks for the reply! Yes the skew method works well. The problem I had was that I needed to be able to select multiple words.

    What I do now is use a code Dan Ebert wrote a while ago. Basically, I have the words encapsulated in square brackets [] be italic and the words in curly brackets {} be bold. I’m using the dirty skew and stroke method.

  • Yoan Boisjoli

    March 9, 2023 at 6:17 pm in reply to: Count number of line breaks?

    Hi Kevin, Yes, it is possible to identify the number of line breaks in a text box using an expression in After Effects. Here is an expression that you can use to achieve this:

    var text = sourceText.value;

    var lineBreaks = (text.match(/\n/g)||[]).length;

    This expression first retrieves the value of the source text, and then uses the match() function with a regular expression to count the number of line breaks in the text. The ||[] part of the expression ensures that the function returns 0 if no line breaks are found.

  • Yoan Boisjoli

    March 8, 2023 at 3:28 pm in reply to: Super weird expression oddity

    Hey Nick, I’m not sure whats going on here. But if you create lots of mogrt and worry about position, this is the best investment I made in awhile:

    https://aescripts.com/pins-and-boxes/

    You should check it out. It might solve your problem.

  • In my case, I need to create a mogrt for subtitles and have selected words be in italics or bold.

    For the italic part I can get by with a skew animator but the real deal would be much better!

  • OH MY GOD Filip!! What sorcery is this!? 😍

  • Yoan Boisjoli

    February 21, 2023 at 1:46 pm in reply to: sourceRectAtTime for shapes?

    Hi Paul, what’s your current syntax?

    In your case you want to get the size of a specific path with a shape layer?

    Did you try to link to it directly from the expression editor with the pick whip?

  • Hi Frederik,

    Have you seen this thread?

    https://creativecow.net/forums/thread/highlight-custom-words-for-mogrt/

    If you wanna select only one word, check this animation preset out (included here)

    If you wanna select more than a word, it is possible (if you go read the thread) but it’s heavy on the machine.

    Highlight custom words (for MOGRT)

Page 9 of 13

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