Forum Replies Created

Page 1 of 2
  • Benoit Kergosien

    June 22, 2017 at 1:43 pm in reply to: Random Hold Times between Each Loop

    Hi,

    Sorry to dig but would it be possible with a pingpong loop?

    Thanks,

    Benoît.

  • For now I can only achieve to parent my 3d layer to a 2D null with the expression:

    ref = thisComp.layer(“2D null”);
    newPosition=ref.toComp([0,0,0]);

    Unfortunately I don’t know what to do next, and if its a good first step btw.

    Benoît.

  • Benoit Kergosien

    April 18, 2015 at 7:19 pm in reply to: Script mask shape to motion path

    Hi,

    Unfortunately I’ve got another problem :

    the path copied via my script isn’t as accurate than the one copied manually.

    See the image attached!

    my code:

    ==============================================

    var myComp=app.project.activeItem;
    var myLayer=myComp.selectedLayers[0];
    var myMask=myLayer.mask(1);
    var times=new Array();

    // Creation of Effects
    var mynumEffects=myLayer.property(“Effects”).numProperties;
    myLayer.property(“Effects”).addProperty(“Point Control”);

    // Customisation of Effects
    var Target=myLayer.property(“Effects”).property(mynumEffects+1);
    Target.name=”myTarget”;
    var myTarget=Target.property(“Point”);
    mynumEffects+=1;

    // Read path content
    var shape=myMask.maskPath.value,
    verts=shape.vertices,
    inTan=shape.inTangents,
    outTan=shape.outTangents,
    numVerts=verts.length;

    // In case of closed shape
    if (shape.closed) {verts.push(verts[0]); inTan.push(inTan[0]); outTan.push(outTan[0]); numVerts++;};

    /*
    // Inject 2D tangents into 3D property (tangents for a motion path always 3D, even for 2D)
    for (var k=0; k < numVerts; k++) inTan [k][2] = outTan[k][2] = 0;
    */

    // Interval of time within wich the animation is adapted
    var step = 2/(numVerts-1);
    for (k=0; k

  • Benoit Kergosien

    March 25, 2015 at 11:40 am in reply to: Script mask shape to motion path

    Found!

    var N=myLayer.property(“Effects”).numProperties; and not var N=myLayer.numProperties;

    Benoit

  • Benoit Kergosien

    March 21, 2015 at 1:50 pm in reply to: Script mask shape to motion path

    I tried to accomplish that you explain to me yesterday but I’ve got error on the line:

    var Target=myLayer.property(“Effects”).property(mynumEffects+1);

    “After Effect error; Unable to call “property” because of parameter 1. Value 12 out of range 1 to 3.”

    ==========

    var myComp=app.project.activeItem;
    var myLayer=myComp.selectedLayers[0];
    var myMask=myLayer.mask(1);
    var times=new Array();

    // Creation of Effects
    var mynumEffects=myLayer.numProperties;
    myLayer.property(“Effects”).addProperty(“Point Control”);
    myLayer.property(“Effects”).addProperty(“Slider Control”);
    myLayer.property(“Effects”).addProperty(“Slider Control”);

    // Customisation of Effects
    var Target=myLayer.property(“Effects”).property(mynumEffects+1);
    Target.name=”myTarget”;
    var myTarget=Target.property(“Point”);

    var slider01=myLayer.property(“Effects”).property(mynumEffects+2);
    slider01.name=”mySlider01″;
    var mySlider01=slider01.property(“Slider”);

    var slider02=myLayer.property(“Effects”).property(mynumEffects+3);
    slider02.name=”mySlider02″;
    var mySlider02=slider02.property(“Slider”);

    mynumEffects+=3;

    // Read path content
    var shape=myMask.maskPath.value,
    verts=shape.vertices,
    inTan=shape.inTangents,
    outTan=shape.outTangents,
    numVerts=verts.length;

    // In case of closed shape
    if (shape.closed) {verts.push(verts[0]); inTan.push(inTan[0]); outTan.push(outTan[0]); numVerts++;};

    // Inject 2D tangents into 3D property (tangents for a motion path always 3D, even for 2D)
    //for (var k=0; k < numVerts; k++) inTan [k][2] = outTan[k][2] = 0;

    // Interval of time within wich the animation is adapted
    var step = 2/(numVerts-1);
    for (k=0; k

  • Benoit Kergosien

    March 20, 2015 at 10:32 am in reply to: Script mask shape to motion path

    Thanks for those explanations Xavier, you are very helpful!

    Benoit

  • Benoit Kergosien

    March 20, 2015 at 9:21 am in reply to: Script mask shape to motion path

    Hi Xavier,

    First of all, big thanks for your time.
    I didn’t have time to test your last piece of code ’cause I’m stucked with the creation of Expression Controls on my layer.

    When I create only one of those (Target) the code works properly but when I add another one (mySlider) the code breaks.

    =======================

    var myComp=app.project.activeItem;
    var myLayer=myComp.selectedLayers[0];
    var myMask=myLayer.mask(1);
    var Target=myLayer.property(“Effects”).addProperty(“Point Control”);
    Target.name=”myTarget”;
    var myTarget=myLayer.property(“Effects”).property(“myTarget”).property(“Point”);

    var mySlider=myLayer.property(“Effects”).addProperty(“Slider Control”);
    mySlider.name=”mySlider”;

    var times=new Array();

    var shape=myMask.maskPath.value,
    verts=shape.vertices,
    inTan=shape.inTangents,
    outTan=shape.outTangents,
    numVerts=verts.length;

    var step = 2/(numVerts-1);
    for (k=0; k

  • Benoit Kergosien

    March 19, 2015 at 2:50 pm in reply to: Script mask shape to motion path

    Oh… Apologies Xavier.

    I really have to comment the code since the begining of my tests.

    BTW is there a way to test if the var myTarget is 2D or 3D? To skip the injection of 2D tangents into 3D if my Target is a true 2D property with an if/else statement.

    Thanks.

    Benoit

  • Benoit Kergosien

    March 19, 2015 at 1:09 pm in reply to: Script mask shape to motion path

    Hi Xavier,

    thanks for your quick answer, it worked like a charm.

    Now I try to copy the motion path to a point control instead of the position property and I have got this error :

    “After Effects error: Unable to call “setSpatialTangentsAtKey” because of parameter 2. Value array does not have 2 elements.”

    =============================

    var myComp=app.project.activeItem;
    var myLayer=myComp.selectedLayers[0];
    var myMask=myLayer.mask(1);
    var myTarget=myLayer.property(“Effects”).property(“Point Control”).property(“Point”);
    var times=new Array();

    var shape=myMask.maskPath.value,
    verts=shape.vertices,
    inTan=shape.inTangents,
    outTan=shape.outTangents,
    numVerts=verts.length;

    var step = 2/(numVerts-1);
    for (k=0; k

  • Benoit Kergosien

    July 6, 2014 at 3:55 pm in reply to: Index/Time of a marker according to comment

    Hi Dan,

    I did your corrections, thanks It works like it should.

    I had this piece of code to the previous expression and I’m close to make it work.

    The only problem is that the value returned since the last marker’s time is the marker’s index, how to avoid this?

    Thanks again Dan, with all your help my abilities in expressions has already improved.

    Benoit

    m = marker;
    prev = 0;
    next = 0;
    var arrayMarker=[];
    var valueMarker=[];
    markerComment="";
    if (m.numKeys > 1){
    nearest = m.nearestKey(time);
    for (i=1; i&lt;=m.numKeys; i++){
    arrayMarker.push(m.key(i).comment);
    }
    for (i = 0; i &lt; arrayMarker.length; i++) {
    if (arrayMarker[i] == '') {
    valueMarker.push(0);
    }
    else if (arrayMarker[i] == 'RIO') {
    valueMarker.push(20);
    }
    else if (arrayMarker[i] == 'TOKYO') {
    valueMarker.push(50);
    }
    }
    if (nearest.time &lt;= time){
    prev = nearest.index;
    if (prev &lt; m.numKeys){
    next = prev+1;
    }
    }else{
    next = nearest.index;
    }
    if (next > 1){
    prev = next-1;
    }
    if (prev != 0 && next != 0){
    t1= m.key(prev).index;
    t2=m.key(next).index;
    markerComment=m.key(t1).comment;
    if (markerComment==arrayMarker[t1-1]) {
    Math.floor(linear(time,m.key(t1).time,m.key(t2).time,valueMarker[t1-1],valueMarker[t2-1]));
    }else{
    null // only have 1 marker -- add some code to deal with that
    }
    }
    }else{ // no markers
    0;
    }

Page 1 of 2

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