Forum Replies Created

Page 3 of 7
  • Fabrice Leconte

    September 10, 2021 at 2:25 pm in reply to: Control more than two keyframes with expressions

    Hello,

    I think you just need to add “if & else” statements.

    something like:

    if(time < key(3).time){

    linear(time,key(1).time,key(2).time,[x – widestA – RLPadding, y],[x – widestEng – RLPadding, y])

    }

    else{

    linear(time,key(3).time,key(4).time,[x – widestEng – RLPadding, y],[x – widestA – RLPadding, y])

    }

  • Hello,

    You can adjust the Y position of the ball by testing the collision with the sine wave.

    First, I tried to use sampleImage to test the collision, it worked but the rendering time was too long (more than 1 hour for a few seconds of video).

    Finally, I tried in a different way, I calculated the distance between the ball and each points of the sine wave and if the distance was lower than the ball radius it means that the sine wave collide with the ball so I adjusted the ball Y position until collision return false.

    https://imgur.com/a/MBQTZZx

    View post on imgur.com

  • Fabrice Leconte

    September 9, 2021 at 6:04 pm in reply to: switch() difficulty

    Hello, line 1, convert the string to a number.

    xx = Number(thisComp.layer('OFFSET').effect('FLIP MODE')('Menu'));

    var jjj = 0

    switch(xx){

    case 1: jjj =0; break;

    case 2: jjj =10; break;

    case 3: jjj =30; break;

    case 4: jjj =50; break;

    case 5: jjj =90; break;

    case 6: jjj =130; break;

    case 7: jjj =180; break;}

    jjj;

  • Fabrice Leconte

    September 8, 2021 at 3:42 am in reply to: Copy selected property to a Null Layer's Position

    For Lockdown use this code:

    function createNulls() {

    var sLayers = thisComp.selectedLayers;

    if (!sLayers.length) {

    alert('Please, select a layer');

    return false;

    }

    var sProperties = thisComp.selectedLayers[0].selectedProperties;

    if (!sProperties.length || sProperties.length < 2) {

    alert('Please, select at least 1 property');

    return false

    }

    app.beginUndoGroup('Copy to Null');

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

    var sProperty = sProperties[i];

    if (sProperty.name.match(/Point[1-4]/)) {

    var myNull = thisComp.layers.addNull();

    myNull.name = sProperty.name;

    myNull.transform.position.expression = 'thisComp.layer("' + sLayers[0].name + '").effect("Lockdown")("' + sProperty.name + '")';

    // OPTIONAL

    // myNull.transform.position.selected = true;

    // app.executeCommand(2639); // Convert Expression to Keyframes

    // myNull.transform.position.expression = ''; // Remove the Expression

    }

    }

    app.endUndoGroup();

    }

    var thisComp = app.project.activeItem;

    createNulls();

  • Fabrice Leconte

    September 7, 2021 at 2:00 pm in reply to: Copy selected property to a Null Layer's Position

    It should work.

    function createNulls() {

    var sLayers = thisComp.selectedLayers;

    if (!sLayers.length) {

    alert('Please, select a layer');

    return false;

    }

    var sProperties = thisComp.selectedLayers[0].selectedProperties;

    if (!sProperties.length || sProperties.length < 2) {

    alert('Please, select at least 1 property');

    return false

    }

    app.beginUndoGroup('Copy to Null');

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

    var sProperty = sProperties[i];

    if (sProperty.numProperties == 2) {

    var myNull = thisComp.layers.addNull();

    myNull.name = sProperty.name;

    myNull.transform.position.expression = 'thisComp.layer("' + sLayers[0].name + '").effect("' + sProperty.name + '")(1)';

    myNull.transform.position.selected = true;

    // OPTIONAL

    // app.executeCommand(2639); // Convert Expression to Keyframes

    // myNull.transform.position.expression = ''; // Remove the Expression

    }

    }

    app.endUndoGroup();

    }

    var thisComp = app.project.activeItem;

    createNulls();

  • Fabrice Leconte

    September 6, 2021 at 11:43 pm in reply to: Copy selected property to a Null Layer's Position

    Hello, maybe something like this:

    app.beginUndoGroup('Copy to Null');

    app.executeCommand(19);

    var controller = app.project.activeItem.layers.addNull();

    controller.name = 'myProp';

    controller.enabled = true;

    controller.property('position').selected = true;

    app.executeCommand(20);

    app.endUndoGroup();

  • Hello, try this:

    myNull = thisComp.layer('Null 1').effect('Checkbox Control')(1);

    freeze = 0;

    for (i = 1; i <= myNull.numKeys; i++) {

    if (i != myNull.numKeys && myNull.key(i) == 0 && time >= myNull.key(i).time) {

    freeze += Math.min(myNull.key(Math.min(i + 1, myNull.numKeys)).time, time) - myNull.key(i).time

    } else if (i == myNull.numKeys && myNull.key(i) == 0 && time > myNull.key(i).time) {

    freeze += time - myNull.key(i).time

    }

    }

    (time - freeze).toFixed(1);

  • Fabrice Leconte

    August 29, 2021 at 3:56 am in reply to: Help with CSV Text list

    OK for multiple rows, try this:

    perRow = thisComp.layer('test.csv')('Data')('Outline').numProperties;

    numOfRows = thisComp.layer('test.csv')('Data')('Number of Rows');

    if (timeToFrames(time) < perRow * numOfRows) {

    row = Math.min(Math.floor(timeToFrames(time) / perRow), numOfRows - 1);

    col = timeToFrames(time) % perRow;

    footage('test.csv').dataValue([col, row]);

    } else {

    'finished'

    }

  • Hello, place it before and after the FOR loop.

    app.beginUndoGroup("undo");

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

    ...

    }

    app.endUndoGroup();

  • Fabrice Leconte

    August 25, 2021 at 10:25 pm in reply to: Help with CSV Text list

    Hello, try this:

    max = thisComp.layer('test.csv')('Data')('Outline').numProperties -1;

    footage('test.csv').dataValue([Math.min(timeToFrames(time),max), 0]);

Page 3 of 7

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