using valueAtTime() on individual channels

Moderators: Disciple, zlovatt

Post Reply
rawbee
Posts: 3
Joined: March 1st, 2006, 10:55 pm

I'm just wondering why this works:

thisComp.layer("m").position.valueAtTime(time - .1)

but this doesn't:

[position[0], thisComp.layer("m").position[1].valueAtTime (time - 0.1)]

TIA!
Robby
davestewart
Posts: 114
Joined: March 10th, 2005, 5:50 am
Location: London, UK
Contact:

Hi Robby,

The problem arises because you are calling the valueAtTime method on a Number (position[1]), not a position Value (position):

Code: Select all

//bad
position[1].valueAtTime(time - 0.1)

//good
position.valueAtTime(time - 0.1)[1]
You may find it easier to understand things in future if you break your code up onto separate lines:

Code: Select all

x = position[0];
y = thisComp.layer("m").position.valueAtTime(time-0.1)[1];
[x,y] 
Cheers,
Dave
rawbee
Posts: 3
Joined: March 1st, 2006, 10:55 pm

Thanks for the tip! I'll try to break it up more often ;) Your code clears up my problem perfectly!
davestewart
Posts: 114
Joined: March 10th, 2005, 5:50 am
Location: London, UK
Contact:

Hilarious. You make it sound like herpes or something!
Post Reply