Sg2.9
Get alpha of object
Recent RSS
Get alpha of object
From:  Frederik
Date:  16. September 2008, 18:49

Hey

I need to know the alpha en color value of an object.

Anybody how to know to do this?

my code:

var sel = document.getMatchingItems(Path, { selected: true });

for (var j = 0; j < sel.length; j++) {
//Dialog.alert(sel[j].curves[2].getPoint(1).x); // ok
//Dialog.alert(sel[j].curves[2].getPoint(1).y); // ok
//Dialog.alert(sel[j].bounds.width-1); // minus 1, because there is a border // ok
//Dialog.alert(sel[j].bounds.height-1); // ok
Dialog.alert(sel[j].color);
}

ps: how do i write a string to the console?

Thx

Re: Get alpha of object
From:  Frederik
Date:  16. September 2008, 19:02

With alpha i mean transparency

Re: Get alpha of object
Date:  18. September 2008, 08:19

The 'Color' Object has an 'alpha' property http://scriptographer.com/Reference/AI/Color/

Use print to write to console: http://scriptographer.com/Reference/SG/Global+Scope/

grz.
gs.

Re: Get alpha of object
Date:  18. September 2008, 14:08

The 'Art' object has an 'opacity' property.

print the opacity value of the first selected item to the console:

print(document.selectedItems[0].opacity);

set the opacity of the first selected item to 50%:

document.selectedItems[0].opacity = 0.5
Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Boxes Flow 19.04.12