Forum Replies Created

Page 23 of 1081
  • Glad to hear it! Doing it this way (where all expressions refer directly to the “leader”) can have a big performance improvement over the method where each expression refers to the previous expression in a cascading way.

  • Ok, sorry, bad syntax on my part. This should give, for a position expression on one of the other books (not the bottom one), a delayed version of the position:

    numBooks = thisProperty.propertyGroup(3).numProperties;
    bottomPos = thisProperty.propertyGroup(3)(numBooks).transform.position;
    dIndex = numBooks - thisProperty.propertyGroup(2).propertyIndex;
    bottomPos.valueAtTime(time - dIndex*.01);
  • I’m not sure what you’re doing with that first line.

    Edit: Ah, I see, hang on–let me take a look.

  • So Group 1 through Group 8 are each a pile of books? And Group 56 through Group 75 are the books in the Group 8 pile (with Group 75 being the book on the bottom)? If so, then I think what I posted applies to your situation.

  • My advice would be to be very careful. My experience is that ChatGPT writes bad code and when in doubt, it will just make stuff up (hallucinations). It has no way to test its code so be sure to test thoroughly before using. Also, if you’re going to post the code in a forum like this one, be sure to clearly identify that it came from a chatbot so folks can be appropriately cautious.

  • I was hoping for more info about how your book stacks are structured, but I’ll just make some assumptions. Let’s say that Group 75 is the bottom book for one stack and that the books in that stack are all in Group 8. If a Transform/Position expression for one of those books wants to reference the bottom book’s position, it would be like this:

    numBooks = thisProperty.propertyGroup(3).numProperties;
    bottomPos = thisProperty.propertyGroup(3).property(numBooks).transform.position;

    and the difference in indices between the book with the expression and the bottom book would be:

    dIndex = numBooks - thisProperty.propertyGroup(2).index

    and you could use that to calculate any delay between the animation of the bottom book and the one with the expression. Something like that. The key is to map out (I used a text layer) what the different levels of propertyGroup() are.

  • It’s not clear what you’re trying to link together. Maybe you could describe that a little better? A diagram that shows what needs to be linked to what would be helpful.

  • Dan Ebberts

    May 14, 2024 at 6:08 pm in reply to: Use a dropdown to select an array?

    This works for me:

    a=thisComp.layer("controls").effect("show")("Menu"); //value of Show menu
    b=thisComp.layer("controls").effect("layout 2")("Menu"); //value of Layout menu
    show1=[[50,50],[500,50],[50,500],[500,500]]; //array of possible positions show 1
    show2=[[100,100],[500,100],[100,500],[500,100]]; //array of possible positions show 2
    showList=[show1, show1, show2]; //dummy "show 1" at [0] for safety
    showName=showList[a]; //showName is [a] value of showList array
    showName[b-1]
  • I think it would be more like this simplified example:

    function getComp(theName){
    for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i) instanceof CompItem && app.project.item(i).name == theName) return app.project.item(i);
    }
    return null;
    }
    var comp = getComp("comp");
    var imageFilePath = '/Users/clara/Movies/AE/Images/my_picture.jpg';
    var importOptions = new ImportOptions(File(imageFilePath));
    var importResults = app.project.importFile(importOptions);
    var layer = comp.layers.add(importResults);
  • Dan Ebberts

    May 14, 2024 at 5:40 pm in reply to: Use a dropdown to select an array?

    I haven’t tested this, but I would think that you’d want use the actual arrays in your showList, not strings representing their names. So like this:

    showList=[show0,show1,show2];
Page 23 of 1081

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