Parent lens flare centre

Moderators: Disciple, zlovatt

Post Reply
amitzinman
Posts: 17
Joined: November 22nd, 2007, 4:56 am
Location: Tel Aviv
Contact:

Hi,
I have a null with some tracking information. I would like to move the lens flare center according to it.
What expression could I use to to parent a property rather than the entire layer?

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

You should be able to just add an expression to the Lens Flare Center property and drag the expression pickwhip to the null's Position property. Which will give you an expression like:

Code: Select all

thisComp.layer("Null 1").transform.position
amitzinman
Posts: 17
Joined: November 22nd, 2007, 4:56 am
Location: Tel Aviv
Contact:

yes, I did that but it doesn't parent it. Its just follows the null's position which is way far off.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

There's no built in way to do something exactly like parenting with expressions, but you can put in an offset. Something like:

Code: Select all

thisComp.layer("Null 1").transform.position + [-100, 50];
amitzinman
Posts: 17
Joined: November 22nd, 2007, 4:56 am
Location: Tel Aviv
Contact:

also, not helping if the tracking data has rotation values.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

I don't really see how rotation comes into it. There's almost certainly a way to do it but maybe you could describe better exactly what's going on, or even better, post a reduced project.
amitzinman
Posts: 17
Joined: November 22nd, 2007, 4:56 am
Location: Tel Aviv
Contact:

Dan Eberts posted this expression as a reply to this query, but in another forum...

L = thisComp.layer("Null 1");
p = L.transform.position;
r = L.transform.rotation;
d = valueAtTime(0) - p.valueAtTime(0);
angle = degreesToRadians(r - r.valueAtTime(0));
s = Math.sin(angle);
c = Math.cos(angle);
x = d[0]*c - d[1]*s;
y = d[0]*s + d[1]*c;

p + [x,y]
Post Reply