Jump to content
Sign in to follow this  
mgrvsh

Script to control locations of keyframes via a curve?

Recommended Posts

Does anyone know of a script that will allow you to affect the temporal locations of a selection of keyframes based on an input curve?

 

For example, I've got 50 layers that all have the same two keyframes on their position property--linear from the left to right across the screen over 10 frames. Now I want to affect the temporal locations of those keyframes with a bell curve such that the keyframes on the layers near the top and bottom of the selection (the left and right ends of the bell curve) will only move a little (say 1 frame to the right), but the keyframes on the layers near the middle of the selection will move much more (20 frames to the right), and all the other keyframes positions will interpolated accordingly.

 

It would also be useful if it only moved the layer on the timeline, rather than the keyframes.

 

Something along the lines of this: http://aescripts.com/pt_shiftlayers/, but with the ability to use a curve to drive the amount of shfiting.

 

 

I couldn't find anything on the internets so I figured I'd ask here before I took to trying to write a script to do this on my own.

Share this post


Link to post
Share on other sites

Holy crap, you rock!

 

One thing I failed to mention in my original post was that I was hoping to be able to use a hand-crafted curve. Like, for example, sampling the coordinates of a curve you draw over an X,Y graph. The only way I imagined this would work is if the script generates a null that has a Slider effect on it with two keyframes--One at zero, one at 100 (or whatever sampling resolution the user wants, based on the number of layers they want to affect). Then the user can draw whatever funky curve they want in the graph editor, provided it stays within the 0-100 vertical and 0-100 horizontal boundaries. Once the user is done drawing, they could execute a second script that uses a valueAtTime to sample the curve and generate an array of values with which to offset the selected layers.

 

Wow. Now that I see it written down it seems a lot easier to do. I think it'd be ideal if it worked on selected keys as well as selected layers, but after looking at the code for Jeff Almasol's Scooter script I realized just how much of a pain in the ass this would be to write for keyframes.

 

I'll take a crack at it over the next couple days and see if I can work it out.

 

Thanks so much for your response!

Share this post


Link to post
Share on other sites

Yeah, what you describe would be more involved. Out of curiosity what are you trying to achieve with this script? And btw, if you do write it yourself we'd be happy to host it on aescripts.

 

Lloyd

Share this post


Link to post
Share on other sites

Out of curiosity what are you trying to achieve with this script?

 

Basically I find myself in a lot of situations where I've got a bunch of layers doing the same motion (scaling up, bouncing around, whatever) in sequence over time. I like to ease the sequencing in or out (like in the picture) but when you've got a ton of layers it can be a pain to drag them to the right spots, and it's not as precise when just doing it by hand. It's something I do often enough that it's worth it for me to spend the time writing the script. Plus I think if I make the process easier, I'll be able to push it and create cooler stuff that was too daunting to try before.

 

Here's an example:

Untitled-1.jpg

 

Share this post


Link to post
Share on other sites

I see. One thing I could do is add a decay parameter so you could get a curve like that with a little tweaking. Would that help in a pinch?

Edited by milkshake

Share this post


Link to post
Share on other sites

That'd be cool. I haven't checked the code, but I'm assuming it'd be pretty easy to add a phase offset and frequency multiplier as well?

 

I think the most important feature of what I'm going for is the ability to draw the curve that ultimately move the layers. That way you can make it as simple or as intricate as you want. I'll work on it this week and see if I can get it going.

 

I'm not in a rush or anything, I just think it'd be a nice tool to have for the future.

Share this post


Link to post
Share on other sites

Well it's done. Right now it only offsets layers because the coding required to offset keyframes (while maintaining easing influences) is intense.

 

1. Install it in your Scripts UI folder.

2. Click 'Generate Curve Effector'

-This creates a null with two keyframes. Tweak the curve between the two keyframes (as well as add new keys, etc.) in the graph editor to define your offset pattern.

3. Select the layers you wish to offset and click 'Go!'

 

Try it out:

http://www.mgravish.com/mg_CurveEffector.jsx

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...