3 Replies Latest reply on Oct 3, 2014 6:59 AM by Mylenium

# Compare the value of the current and the Last keyframe

Hey there,

in our company we built some ad, which is an html5 game (view the attachement). The user is able to move the ball through the labyrinth by tilting/moving the phone using the gyroscope-sensor inside of it.

Now our ceo asked me if i would be able to make a video out of it for a power-point presentation.

With a software tool i made a video-screenshot of the iphone screen, with it's interaction.

After that i imported the video to afx and added the video the iphone-frame and the hand.

Tracking of the ball didn't worked because of the rotating texture of the ball, but i followed the movement with a null-object.

Owning the information of the Balls movement in a null-object i connected the hand and the phone to the null-object. Getting the look the hand interacts with the game.

The movement of the Hand was to much so i divided the movement of the distance by 2 in an expression.

NOW THE PROBLEM:

The movement of the ball is just changing the parameter of the "position" not of the "rotation".

So i would like to the value of the current keyframe and of the last keyframe and get a value which is the difference of them (x-y=new value). But i don't know how to collect the data of these by an expression.

Could someone help?

• ###### 1. Re: Compare the value of the current and the Last keyframe

You have to use valueAtTime() to retrieve different positions at different times. the rest is unclear. Your description is somewhat confusing and you are throwing together different unrelated things.

Mylenium

• ###### 2. Re: Compare the value of the current and the Last keyframe

Hey Wow, you guys are really quick here.

Sorry didn't want to confuse anyone here.

I will go a little more into it.

If i am only taking the x value of the position and compare the actual state of x value with the satus of the x value of the keyframe before.

i will take this two values x1 and x2 to take the difference between them. With this new value.

i can modify the angle of the rotation between -90 and +90.

Know what i mean?

but i am not sure if valueattime works in this case because i need the information dynamic.

• ###### 3. Re: Compare the value of the current and the Last keyframe

How more dynamic can it get?

tOff=framesToTime(1);

xNow=transform.position[0];

xPre=transform.position.valueAtTime(time-tOff)[0];

xDiff=xNow-xPrev;

That's all there is to it. Expressions are evaluated after keyframe data and even if it were the other way around, you could still control evaluation order by applying the expression to a different layer...

Mylenium