8 Replies Latest reply on Apr 27, 2008 9:40 AM by Mylenium

    EXPRESSION help,layer markers

    Level 1
      Hi

      I've got a comp with one camera and 100 3d layers distributed randomly in 3 space.Each layer has got a different z-Rotation value.
      The camera animates from one layer to the other via script (the script generates
      automatically layer markers and keyframes for each animation).So,there are 101 layer markers.

      Example:
      The camera moves between layer marker 2+3 from layer 2 to 3 for example.
      Layer 2 has got a z-rotation value of -14° and layer 3=>45°.

      basically,i need a camera (z orientation) expression so the camera animates
      from -14° to 45° between these two layer markers and so on.

      THX
        • 1. Re: EXPRESSION help,layer markers
          Mylenium Most Valuable Participant
          There's an age-old tutorial from Dan Ebberts at Creative COW dealing with this. It is aimed at time-remapping, but you should be able to substitute the code with some simple linear() stuff to remap the time between intervals to the actual rotation. Give it a spin and check back if you get stuck. We'll try to pull our wits together and help you. ;-)

          Mylenium
          • 2. Re: EXPRESSION help,layer markers
            Level 1
            Hi

            I have no idea ........it's far beyond my expression knowledge :-(
            //expression for the camera's orientation so far
            n = 0;
            if (marker.numKeys > 0){
            n = marker.nearestKey(time).index;
            if (marker.key(n).time > time){
            n--;
            }
            }

            if (n == 0){
            value

            }else{

            z=Math.min(thisComp.layer(index).transform.zRotation-thisComp.layer(index-1).transform.zRo tation)+0.1;
            • 3. Re: EXPRESSION help,layer markers
              Mylenium Most Valuable Participant
              Yeah, what part of the equation do you not understand? The first part simply checks whether markers exist at all, then counts them down until there are none left after a given time. If you want to blend between the different values, you'd simply need to plug the marker times into the remapping. Something like this:

              markNow=marker.nearestKey(time).index;
              markNext=marker.nearestKey(time).index+1;

              timeNow=marker(markNow).time;
              timeNext=marker(markNext).time;

              rotationNow=thisLayer.transform.zRotation.valueAtTime(timeNow);
              rotationNext=thisComp.layer(index+1).transform.zRotation.valueAtTime(timeNow);

              rotationFinal=linear(time,timeNow.timeNext,rotationNow,rotationNext)

              You only need to include this in the curly braces or return n outside the function to make use of this. Haven't tested it, as I'm not in front of AE, but on an abstract level this is how it should work. Hope it helps to get yoou started.

              Mylenium
              • 4. Re: EXPRESSION help,layer markers
                Level 1
                Hi Mylenium

                first of all,thanks for your help.

                i timeNow=marker(markNow).time;
                this line gives me an error message.The function marker() is not defined.
                • 5. Re: EXPRESSION help,layer markers
                  Mylenium Most Valuable Participant
                  Yeah, it's possible that the syntax is incorrect. As I wrote, I'm not always in front of AE and do not know everything off hand. I'll look into the matetr and try to come up with a more correct expression.

                  Mylenium
                  • 6. Re: EXPRESSION help,layer markers
                    A. Cobb Level 3
                    The correct syntax would be:
                    >timeNow = marker.key(markNow).time;

                    "marker" is a property, just like position or scale, and the markers are its keys.
                    • 7. Re: EXPRESSION help,layer markers
                      Level 1
                      Thank you Aaron.

                      that's what i have so far

                      n = 0;
                      if (marker.numKeys > 0){
                      n = marker.nearestKey(time).index;
                      if (marker.key(n).time > time){
                      n--;
                      }
                      }
                      if (n == 0){
                      value
                      }else{
                      markNow=marker.nearestKey(time).index;
                      markNext=marker.nearestKey(time).index+1;
                      timeNow = marker.key(markNow).time;
                      tNext=marker.key(markNext).time;
                      rotationNow=thisLayer.transform.zRotation.valueAtTime(timeNow);
                      rotationNext=thisComp.layer(index+1).transform.zRotation.valueAtTime(timeNow);
                      rotationFinal=linear(time,timeNow,tNext,rotationNow,rotationNext)
                      }

                      There is still something wrong with this syntax as the value always remains zero,mmhhhhh.
                      • 8. Re: EXPRESSION help,layer markers
                        Mylenium Most Valuable Participant
                        I've uploaded a working project to my website (AE7). Sorry for taking so long. Just too damn busy with other things at the moment.

                        http://creation.mylenium.de/motiondesign/ae_downloads/files/ae_misc_travel_along_markers.z ip

                        Mylenium