Mailing List AE-List@media-motion.tv ? Message #41258
From: mylenium@mylenium.de <mylenium@mylenium.de>
Subject: Re: [AE] smooth keyframes expression
Date: Wed, 14 Dec 2011 13:28:01 +0100 (CET)
To: After Effects Mail List <AE-List@media-motion.tv>

To add to what I just wrote: You are trying to get the time value outside the valueAtTiem() function, that's why it doesn't work. Use the syntax I suggested rather than using the extra variables afterwards.


Mylenium

[Pour Mylène, ange sur terre]
-----------------------------------------
www.mylenium.de


---------- Ursprüngliche Nachricht ----------
Von: "mylenium@mylenium.de" <mylenium@mylenium.de>
An: After Effects Mail List <AE-List@media-motion.tv>
Datum: 14. Dezember 2011 um 13:23
Betreff: Re: [AE] smooth keyframes expression

valueAtTime() evaluates time, so the keyframes don't matter. Keyframe indices on the other hand start at 1... Anyway, use p.valueAtTime(f)[0] to address the X component only. That's the only obvious issue I can see on a quick glance...

 

Mylenium  

 

[Pour Mylène, ange sur terre]
-----------------------------------------
www.mylenium.de

 


Sascha Gritz <s.gritz@vucx.de> hat am 14. Dezember 2011 um 13:14 geschrieben:

> Dear list,
> sorry for the wrong subject I used for the last email.
> We  got the following problem:
> we track a point and give the tracked position data (x,y) to a null
> object. What we want to do now is write an adjustable expression that
> compares the values of the tracked data from frame to frame that
> determines changes in position that are above a specific threshold. Only
> if a change in position is beyond this threshold, movement should take
> place.
>
> We put the expression on the keyframed transform.position of our
> null-object.
> but it seems it isn't working.
>
> The error we get at this point is that valueAtTime(0) is undefined.
> Although there is a Keyframe at frame 0;
> since we step from error to error, there must be another problem.
>
> By the way, the smooth function on the other hand is not an option,
> because it produces, in regard to our footage, not a fitting movement.
>
> here is what we tried:
>
> ------------------------------
> CODE
> ------------------------------
>
> p = transform.position;
>
> //we go through the frames and determine if major changes has taken place
>
> for (f = 0; f <= timeToFrames(); f++){
>
> savepos = p.valueAtTime(0);  //error at this line!
>
> if (timeToFrames(0) == 0){
> lastpos = savepos;
> }
>
>
> // define two points in time to compare values of these two
>
> now = framesToTime(f);
> nextnow = framesToTime(f+1);
>
> tempLoc1 = p.valueAtTime(now);
> tempLoc2 = p.valueAtTime(nextnow);
>
> tempX1 = tempLoc1[0];
> tempX2 = tempLoc2[0];
> tempY2 = tempLoc2[1];
>
> threshold = 0.5;
>
>
> // if there is a change that is big enough we set the new position, else
> it stays as before
>
> if (tempX1 < tempX2+threshold){
> lastpos = [tempX2,tempY2];
> p = lastpos;
>
> }else{
>
> p = lastpos;
>
> }
>
> }
>
>
> ------------
> END CODE
> ------------
>
> Many thanks in advance,
> Sascha
>
>
> --
> __________________________________
> VISION UNLTD. CREATIVE WORX GmbH
>
> Bruesselerstr. 85
> 50672 Koeln
>
> Fon +49 (0)221 56978 42
> Fax +49 (0)221 56978 11
> Mob +49 (0)178 7992039
> s.gritz@vucx.de
>
> check out our web page: www.vucx.de
> die medienprofis: www.profigilde.de
>
>
>
> +---End of message---+
> To unsubscribe send any message to <ae-list-off@media-motion.tv>
 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster