Copy link to clipboard
Copied
I'm trying to change/access the opacity of a text object (Illustrator CC).
In the documents, I found that it's represented by a text frame object, but it doesn't have opacity property. Text range and character attributes don't have it either, so I'm wondering: is there any way of accessing/altering the opacity of a text object using Javascript?
Copy link to clipboard
Copied
This works in VB.NET if this is of any help...
Dim aDoc As AI.Document = app.ActiveDocument
For Each pi In aDoc.PageItems
Select Case TypeName(pi)
Case "TextFrame"
Dim tf As AI.TextFrame = pi
tf.Opacity = 20 '20% Opacity
End Select
Next
Copy link to clipboard
Copied
it is not documented but text frames do have opacity property in Javascript, as stated above in vb as well.
yourTextFrame.opacity = 50; // 50% opacity
Copy link to clipboard
Copied
Hi Carlos, as inquired in this recent thread:
http://forums.adobe.com/thread/1350419?tstart=0
Does illustrator have the ability to change opacity at the per character level like in the UI via scripting?
Copy link to clipboard
Copied
I couldn't do it directly, the workaround is
- create a new character style manually with the opacity needed
- apply such character style to any textRange via scripting
Copy link to clipboard
Copied
CarlosCanto wrote:
I couldn't do it directly, the workaround is
- create a new character style manually with the opacity needed
- apply such character style to any textRange via scripting
Hi CarlosCanto, ok thanks for the heads up, I was unable to target it directly in my attempts either. Thanks for the workaround idea, that becomes a bit cumbersome if you have a large number of values desired however. It always amazes me how many of the UI features are inaccessible via scripting (sigh). Thanks again for responding.