Forum Replies Created

Page 80 of 1081
  • Probably something close to this:

    tMin = null;
    for ( i = 1; i <= thisComp.numLayers; i++){
    if (i == index) continue;
    m = thisComp.layer(i).marker;
    if (m.numKeys == 0) continue;
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    if (n > 0){
    t = time - m.key(n).time;
    if (tMin == null){
    tMin = t;
    }else{
    tMin = Math.min(tMin,t);
    }
    }
    }
    tMin == null ? 0 : tMin
  • Dan Ebberts

    August 26, 2022 at 11:15 pm in reply to: Move Y axis

    Like this:

    +[0,20]

  • Dan Ebberts

    August 23, 2022 at 7:48 am in reply to: How can I change the time of one or some keyframes?

    It’s quite tricky, and it takes a surprising amount of code to do it right. Your best bet might be to get your hands on Jeff Almasol’s rd_Scooter script, which I believe has the code necessary to move keyframes. I think you can still get it from aescripts. The last time I saw it, it was still a .jsx file, not .jsxbin, so you’ll be able to see how he did it.

  • Dan Ebberts

    August 22, 2022 at 9:38 pm in reply to: Randomly/semirandomly duplicate a frame?

    I’m not sure if this is anywhere near what you’re looking for, but this time remapping expression should hold roughly 20% of the frames for 3 frames, the others for 2:

    randomPct  = 20;
    f = timeToFrames(time);
    fNew = i = 0;
    seedRandom(index,true);
    framesToTime(fNew)
    while (i <= f){
    i += random(100) < randomPct ? 3 : 2;
    fNew ++;
    }
    framesToTime(fNew)
  • Dan Ebberts

    August 22, 2022 at 2:40 pm in reply to: Setting path vertices using scripting

    This example shows how you could add [10,10] to each vertex of a shape path:

     var myComp = app.project.activeItem;
    var myLayer = myComp.layer(1);
    var myPathObject = myLayer.property("Contents").property("Shape 1").property("Contents").property("Path 1").property("Path");
    var myPath = myPathObject.value;
    var myVertices = myPath.vertices;
    var v;
    for (var i = 0; i < myVertices.length; i++){
    v = myVertices[i];
    myVertices[i] = [v[0] + 10, v[1] + 10];
    }
    myPath.vertices = myVertices;
    myPathObject.setValue(myPath);
  • Dan Ebberts

    August 22, 2022 at 2:20 pm in reply to: How can I change the time of one or some keyframes?

    Are you talking about scripting? Unfortunately, you can’t change the time of a keyframe via scripting. You have to create a new keyframe, copy all the attributes of the old one (which can be quite involved and order-sensitive), and delete the old one.

  • Dan Ebberts

    August 19, 2022 at 2:06 pm in reply to: Multiple DropDown Menu (without overlapping layers)

    Hard to say for sure, without seeing what you have, but I’m guessing that this:

    if(ManuLang == 5 ){100} else {0};
    if(dropMenu == 4 ){100} else {0};

    needs to be like this:

    if((ManuLang == 5 ) && (dropMenu == 4)){100} else {0};

  • Dan Ebberts

    August 19, 2022 at 4:48 am in reply to: Precise, ramped (gradual) time remapping

    I think what you’re trying to do falls in the category of speed control described here:

    http://www.motionscript.com/articles/speed-control.html#linear

  • Something like this for Comp B should get the text from Comp A, but replace the line breaks with spaces:

    txt = comp("Comp A").layer("Master Text").text.sourceText;
    txt.split("\r").join(" ")
  • This is pretty limited and not well tested. If the two paths don’t have the same number of points, it doesn’t do anything. It assumes that the slider is on the layer with the expression.

    path1 = thisComp.layer("Shape Layer 1").content("Shape 1").content("Path 1").path;
    path2 = thisComp.layer("Shape Layer 2").content("Shape 1").content("Path 1").path;
    s = effect("Slider Control")("Slider");
    p1 = path1.points();
    p2 = path2.points();
    it1 = path1.inTangents();
    it2 = path2.inTangents();
    ot1 = path1.outTangents();
    ot2 = path2.outTangents();
    if (p1.length == p2.length){
    newP = [];
    newIt = [];
    newOt = [];
    for (i = 0; i < p1.length; i++){
    newP.push(linear(s,0,100,p1[i],p2[i]));
    if (it1.length > 0 && it2.length > 0){
    newIt.push(linear(s,0,100,it1[i],it2[i]));
    }else if (it1.length > 0){
    newIt.push(linear(s,0,100,it1[i],[0,0]));
    }else if (it2.length > 0){
    newIt.push(linear(s,0,100,[0,0],it2[i]));
    }
    if (ot1.length > 0 && ot2.length > 0){
    newOt.push(linear(s,0,100,ot1[i],ot2[i]));
    }else if (ot1.length > 0){
    newOt.push(linear(s,0,100,ot1[i],[0,0]));
    }else if (ot2.length > 0){
    newOt.push(linear(s,0,100,[0,0],ot2[i]));
    }
    }
    createPath(newP,newIt,newOt,path1.isClosed());
    }else
    value;
Page 80 of 1081

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