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

I cannot change fill opacity in javascript.

New Here ,
Mar 10, 2020 Mar 10, 2020

스크린샷 2020-03-11 오전 3.57.59.png

 

I want to change fill opacity to 62.

 

pathItem.opacity = 62;

but it changed entire opacity not fill opacity.

 

Any Ideas?? Please help.

TOPICS
Scripting
968
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
Adobe
Contributor ,
Mar 10, 2020 Mar 10, 2020

There are unfortunately many many limitations to scripting in Illustrator. Since ExtendScript Toolkit was retired I haven't figured out any way to browser the JavaScript API but looking at the AppleScript dictionary the opacity properties that exist only seem to apply to full objects. So my best guess would be that what you're asking to do simply isn't possible.

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
Community Expert ,
Mar 10, 2020 Mar 10, 2020

What happens if you use pathItem.fillColor.opacity = 62?

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
Community Expert ,
Mar 11, 2020 Mar 11, 2020

nothing will happen Larry, color object does not have opacity property. You would actually assign your own opacity property that you could read later like any other variable.

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
Community Expert ,
Mar 11, 2020 Mar 11, 2020
LATEST

as mentioned, opacity is applied to objects, not to fill or stroke.

 

to work around that, you could record an Action that assigns the opacity of your choice, then have your script play such action. It works beautifully.

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