Return-Path: Received: from moutng.kundenserver.de ([212.227.126.186] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP id 4562979 for ae-list@media-motion.tv; Wed, 14 Dec 2011 13:08:36 +0100 Received: from grinch.local (xdsl-213-196-213-231.netcologne.de [213.196.213.231]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MfDvq-1RM0hj2ylO-00PBDN; Wed, 14 Dec 2011 13:14:37 +0100 Message-ID: <4EE8932D.7070308@vucx.de> Date: Wed, 14 Dec 2011 13:14:37 +0100 From: Sascha Gritz Organization: VUCX User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: After Effects Mail List Subject: [AE] smooth keyframes expression References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:YZ/3thtZ03Ru9OfmTgXTei1CRNFSi+6/zVhnkQXYBMM sSzUeOFFDmqZs4T4wWq2Lkgjb3Soo5Q6ez82CkwkA8YC/iNubh B261+u8p/15m/lUWvGnZZ0GuTIM9offUumbxUIHXrvAsLkSwXZ zB6qaE3hFjt9/j7x+UxFnLbANS4f6fJMEfCkH86BU0gVm7QXdU ZutXf/X8XATM1ZR+ux00ZW/I1WKFPwOThVyQR/RDg7L/2CtmZk J0igdLMbPwZ/hI+xM7J+3/rjO0wvyT7rYtQhK9aim4Rj/C5K/Y IZXW01HBOTSByI4NBpkZNJ6hTJHzX+fTB8YqQm8jLWKt1mHmg= = 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