2 Replies Latest reply: Nov 12, 2013 9:42 PM by saigon80 RSS

    transform center point

    saigon80 Community Member

      When i do a transformation one layer , i want to move the center point to a specific coordinate of the image. How to do that with script , because I have to do that hundreds of time. Thank you !

        • 1. Re: transform center point
          Michael L Hale Community Member

          If you don't want to use one of the preset anchor positions you need to use Action Manager.

           

          function transform( x, y) {// anchor position as pixels
              var desc = new ActionDescriptor();
                  var ref = new ActionReference();
                  ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
              desc.putReference( charIDToTypeID('null'), ref );
              desc.putEnumerated( charIDToTypeID('FTcs'), charIDToTypeID('QCSt'), charIDToTypeID('Qcsi') );
                  var desc7 = new ActionDescriptor();
                  desc7.putUnitDouble( charIDToTypeID('Hrzn'), charIDToTypeID('#Rlt'), x );
                  desc7.putUnitDouble( charIDToTypeID('Vrtc'), charIDToTypeID('#Rlt'), y );
              desc.putObject( charIDToTypeID('Pstn'), charIDToTypeID('Pnt '), desc7 );
              desc.putUnitDouble( charIDToTypeID('Wdth'), charIDToTypeID('#Prc'), 100 );
              desc.putUnitDouble( charIDToTypeID('Hght'), charIDToTypeID('#Prc'), 100 );
              desc.putBoolean( charIDToTypeID('Lnkd'), true );
              desc.putEnumerated( charIDToTypeID('Intr'), charIDToTypeID('Intp'), charIDToTypeID('Bcbc') );
              executeAction( charIDToTypeID('Trnf'), desc, DialogModes.ALL );
          };
          
          transform( 584, 330)
          
          • 2. Re: transform center point
            saigon80 Community Member

            you really helped me !