Return-Path: Received: from moutng.kundenserver.de ([212.227.126.171] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP id 4562998 for AE-List@media-motion.tv; Wed, 14 Dec 2011 13:17:32 +0100 Received: from oxltgw05.schlund.de (oxltgw05.schlund.de [172.19.158.43]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0Lzai2-1Qg6lD3dcw-014ks8; Wed, 14 Dec 2011 13:23:33 +0100 Date: Wed, 14 Dec 2011 13:23:33 +0100 (CET) From: "mylenium@mylenium.de" Reply-To: "mylenium@mylenium.de" To: After Effects Mail List Message-ID: <886468867.393137.1323865413692.JavaMail.open-xchange@email.1und1.de In-Reply-To: References: Subject: Re: [AE] smooth keyframes expression MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_393136_983792065.1323865413538" X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v- X-Provags-ID: V02:K0:EqRt64Nkbz570GDiFzYJz8ZBzuUcx4P8IAhpLBnjm63 hRGW4E4sG//Z0+8Urc/yHyyiDBtNYBccuQDBQ6Iy2WmtEj26vj zZaKNV+f6HlZKhGvIhUJSlp5Qps0lkh8Z9slHedDcVkhiZYle7 3v3+GbxNX7c/KkKGnCxRUqw4DHyFon15sU7y5Rdq2WcyOL9j8u f3yBe574LwvRvSz+63h6NaZRH5CQ49rcEkDFo67N8X9B0ebc9L /RjTKeB58o/xb0VNIti/X27X/sqtxyHIWvJtG6CTo+nvV+uYAl J/eXGhACrWYsbBzISA30S5lUgFS+F3f6L42L+fvs/cYHxTmFCw 7LZ8ZJdj5CQDXrb0lxzW3bHhqP2tWOQF5w9M5IhzHNI5uw09Qc GO+eo5xH/gFuAPIyhu81qg13z4PKCbf+hep/XnCFTalaRFcGQK 2KJvd ------=_Part_393136_983792065.1323865413538 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable valueAtTime() evaluates time, so the keyframes don't matter. Keyframe indic= es 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..= . =C2=A0 Mylenium =C2=A0 [Pour Myl=C3=A8ne, ange sur terre] ----------------------------------------- www.mylenium.de Sascha Gritz hat am 14. Dezember 2011 um 13:14 geschriebe= n: > Dear list, > sorry for the wrong subject I used for the last email. > We=C2=A0 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 =3D transform.position; > > //we go through the frames and determine if major changes has taken place > > for (f =3D 0; f <=3D timeToFrames(); f++){ > > savepos =3D p.valueAtTime(0);=C2=A0 //error at this line! > > if (timeToFrames(0) =3D=3D 0){ > lastpos =3D savepos; > } > > > // define two points in time to compare values of these two > > now =3D framesToTime(f); > nextnow =3D framesToTime(f+1); > > tempLoc1 =3D p.valueAtTime(now); > tempLoc2 =3D p.valueAtTime(nextnow); > > tempX1 =3D tempLoc1[0]; > tempX2 =3D tempLoc2[0]; > tempY2 =3D tempLoc2[1]; > > threshold =3D 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 =3D [tempX2,tempY2]; > p =3D lastpos; > > }else{ > > p =3D 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 ------=_Part_393136_983792065.1323865413538 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

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>
------=_Part_393136_983792065.1323865413538--