Controling individual vertices in a path

What type of scripts do you need?

Moderator: byronnash

Post Reply
mihak
Posts: 5
Joined: March 23rd, 2008, 6:50 am

Hello.

I am looking for a way to animate a path, by adjusting the X and Y properties of a separate node. I've been told that it's only possible with a script. Since I have no experience writing (or even working with) scripts, I'm asking if there is one out there already, or if someone would be kind enough to write one, or explain how to write one.

Thanks.
Last edited by mihak on March 24th, 2008, 7:14 am, edited 1 time in total.
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

Have you looked at http://www.motionscript.com?
"Up And Atom

No...No

Up And At Them!"
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Here's a script that can be used to animate the individual vertices of a mask path:
Rototracking palette for AE (6.5, 7, CS3)

Although it's intended for rototracking, you can use it to control mask vertices by other means. Here are some steps you can try:
1. Download the RotAE1.1.jsx script from the above link.
2. Select File > Scripts > Run Script File and choose the RotAE1.1.jsx script to launch the floating palette.
3. Create a new comp, with a solid layer of the same size.
4. Select the mask pen tool and draw a 3 point mask on the solid layer.
5. Twirl open the timeline properties and select Mask 1.
6. Click the palette's "Apply Tracker" button.
7. With the layer selected, press the U key twice quickly (the UU shortcut reveals all altered properies). You'll see a motion tracker with 3 points has been added to the layer.
8. Double click the layer in the timeline to open its layer window. Select to view Motion Tracker Points and you'll see each point is at the position of one of the mask vertices.

If you were doing this on a footage layer, you could now use the tracker controls to create keyframes. But in this example, we're doing it with nulls and expressions.

9. Select Layer > New > Null Object. Create three nulls, called Null 1, Null 2, Null 3.
10. Select all three nulls and press P to view the Position properties.
11. Select the solid's Tracker 1 > Track Point 1 > Attach Point property and do Edit > Copy.
12. Select the Null 1 Position property and do Edit > Paste.
13. Repeat with the other two track points.
Return to looking at the composition panel. There are now 3 nulls, one positioned at each of the mask vertices.

14. Animate the Null Position properties.
15. Select the Track Point 1 Attach Point property and choose Animation > Add Expression.
16. Either use the expression pickwhip to link to the Null 1 Position property, or add this expression:

Code: Select all

thisComp.layer("Null 1").transform.position
17. Repeat for the other two track points, linking them to Null 2 and 3.
18. Select all three Attach Point properties and choose Animation > Keyframe Assistant > Convert Expression To Keyframes.
19. Select the solid layer's Tracker 1 and Mask 1 property group names.
20. Finally, click the palette's "Apply Mask" button.

The mask vertices will now be animated to match the Nulls. If you change the Null animations, repeat steps 18-20 to update the mask.

Does that help?

Paul
mihak
Posts: 5
Joined: March 23rd, 2008, 6:50 am

Atomic: Thanks for the link.

Paul Tuersley: Thanks, that works great. :)
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Wow, thats a great workaround for being able to apply and positional data you want to a mask! Thanks Paul!!
if it's not fun, what's the point?
http://www.mackdadd.com
mihak
Posts: 5
Joined: March 23rd, 2008, 6:50 am

Paul: Any idea how to avoid memory problems? I have a 32 point mask, animated over 1 minute. The problem is that when i try to apply the mask i always get the memory shortage error (it only uses RAM, not disc cache?), when i try to make a segment long more than about 1 second. Any solutions?

This is what i'm making if anyone is curious:
http://shrani.si/f/2X/qY/1deo9Ed4/house4.avi
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

I tried it myself with a 32 point mask over 1000 frames, on an Intel Mac with 2GB RAM. Curiously it worked ok on AE7 (running under Rosetta PPC emulation), but crashed AE CS3 8.0.2.

I think the problem may be caused by the script's use of app.beginUndoGroup (which groups all changes into a single undo), so I've removed that. I've also made it read the result of expressions on the trackers, so if you're doing the steps above, you no longer need to "Convert Expression To Keyframes".
Download RotAE1.2.zip

Let me know if it solves your problem and I'll post it on the main thread.

Paul
mihak
Posts: 5
Joined: March 23rd, 2008, 6:50 am

Thanks Paul. Works like a charm. The processing time is a bit long, but i guess its simply the nature of the script. Haven't tried the expression value read yet, but it sounds great.

Great work!
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

I've posted an update on the original thread that properly fixes the memory issue. It's probably a bit faster too.
Rototracking palette for AE (6.5, 7, CS3)

Paul
Post Reply