Forum Replies Created

  • Amazing, this works perfectly. Thank you so much!

  • Charlie Laud

    January 14, 2019 at 8:40 pm in reply to: Manipulate shape layer vertices via script

    Alright, so far so good!

    Now I need to find a way to access the transform properties of the shape itself (not the layer transforms) to copy that data into the new shape as well. (i.e. take the shape Position and Anchor Points and add them to the new shape.)

    What would the code for that be? I’ve been trying to use the documentation to help with this, but it doesn’t seem to provide a clear enough picture of how these hierarchies are structured, so thanks in advance for your help!

  • Charlie Laud

    January 14, 2019 at 3:08 am in reply to: Manipulate shape layer vertices via script

    Perfect! Thanks for your help Dan!!

  • Charlie Laud

    January 13, 2019 at 9:04 pm in reply to: Manipulate shape layer vertices via script

    Or better yet –

    Is there a way to create a “custom” shape from an array of points? That way I could copy the values from an existing shape, and create a new shape with slightly modified versions of those values.

  • Charlie Laud

    July 6, 2017 at 6:45 pm in reply to: Change string value to time value to frames

    This will take a string with a minute:second format and convert it to a frame number, depending on your frame rate:

    myString = ;
    frameRate = 1/thisComp.frameDuration;
    timeArray = myString.split(":");
    numFrames = (timeArray[0]*60*frameRate) + (timeArray[1]*frameRate)

  • Here’s what I came up with!

    Basically if you precompose all the sprites into one preComp, (each sprite gets its own frame), you can enable time remapping on that preComp layer and use some lines of code to “tell” it to cycle through each different set of sprites depending on the direction your sprite is moving. That’s as simple as using the valueAtTime() to find the difference between some position value at “current frame” and “current frame – 1”.

    So precompose all those sprites in one layer. Right click on the layer and select Time> Enable Time Remapping and add this code:

    directionNum = 0;
    dX = transform.xPosition.valueAtTime(time) - transform.xPosition.valueAtTime(time - framesToTime(1));
    dY = transform.yPosition.valueAtTime(time) - transform.yPosition.valueAtTime(time - framesToTime(1));

    if (dX > 0) {directionNum = 8;}
    if (dX < 0) {directionNum = 4;}
    if (dY > 0) {directionNum = 0;}
    if (dY < 0) {directionNum = 12;}
    framesToTime(directionNum + (timeToFrames(time) % 4))

    NOTE: you’ll have to Separate Dimensions on the position value, and it doesn’t seem to be too happy with anything other than linear keyframes. For some reason keeping the dimensions together was giving me some big ol trouble.

    Hope this helps! Or is at least enough to get you started!

  • Charlie Laud

    June 30, 2017 at 1:00 pm in reply to: Animate in steps

    Hey Vojtech,

    If I’m understanding this correctly, the modulus operator (%) should be able to help!

    transform.rotation % (360*80)

    The above code would reset transform.rotation back to 0 every time it reaches a value higher than 360 * 80. So if you put % (360*80) at the end of your expression, it will continuously keep the return value from exceeding the upper limit of the evolution parameter.

    You might be able to eliminate keyframes entirely with something like this:


    updateFreq = 24; //step forward every 24 frames
    radialStepValue = 30; //by 30 degrees
    (Math.floor(timeToFrames(time/update Freq))*radialStepValue) % (360*80)

  • Hey Josh,

    It might be as simple as throwing a modulus operator (%) after your rotation value:

    transform.rotation % 360

    That should re-evaluate to zero every time you pass 360!

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