Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Changing the Height with Javascript

Engaged ,
Sep 03, 2021 Sep 03, 2021

Hello,

I want to change the height of an object:

// Transfomation.Center = true;
selectedNewObjects[0].height = vHeight;    // Reset the height

but the orgin should be the center of the object.

I found the constant  "Transfomation.Center". But how can I set it before I change the height?

 

– Jens.

TOPICS
Scripting
246
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Sep 03, 2021 Sep 03, 2021

You could use resize(), which uses percentages of present width and height and for which I think Transformation is CENTER by default.  So, to double your height:

 

selectedNewObjects[0].resize(100, 200);

 

If you want to use a new height, you'll have to convert it to a percentage of the present height. 

Translate
Adobe
Guide ,
Sep 03, 2021 Sep 03, 2021

You could use resize(), which uses percentages of present width and height and for which I think Transformation is CENTER by default.  So, to double your height:

 

selectedNewObjects[0].resize(100, 200);

 

If you want to use a new height, you'll have to convert it to a percentage of the present height. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 03, 2021 Sep 03, 2021
LATEST

Thanks, that will do it. 🙂

var vScaleY = 100 - (((selectedNewObjects[0].height - vHeight) / vHeight) * 100);
selectedNewObjects[0].resize(100,vScaleY);

– Jens 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines