Return-Path: Received: from moutng.kundenserver.de ([212.227.126.187] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP id 4562904 for ae-list@media-motion.tv; Wed, 14 Dec 2011 11:51:41 +0100 Received: from grinch.local (xdsl-213-196-213-231.netcologne.de [213.196.213.231]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0LpRkv-1R7F4d3r7d-00ei7Q; Wed, 14 Dec 2011 11:57:43 +0100 Message-ID: <4EE88126.5060109@vucx.de> Date: Wed, 14 Dec 2011 11:57:42 +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: Re: [AE] Fun bit of animation References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:YqdJ7FsiPNqDysr7nlSSff8T3vRkBWDJhHM5I8UZ6jX lhW8lwQQt2lKysq+55ilcA5jLJP3a/oBpXSpX3ptbvkgHk5zT/ cUCcROQxYSXv5o4LD1vPgiQpsrc9guwUef2LVOgqtS55+Iw1aq On9XUhJdXB7n+PPHsnR1u/Goh7akdPITS3T/RZxGwbgJPY9pMq NCJlYBm+ztM99rZhr5VrVOGj+tcaAX83iFChwm1FZJICZOBtEh DZFk/u0KXEM0vqyTJgq5IZnHa/PewN9X1/EtkMHl4t6YK0ntx8 ooh2qEkMf3GTy4sUznVsCA6fzPy7igZqTT812OGyfcB5CjThQ= = Dear list, 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