2012-03-27 3 views
3

경로 항목에 액세스 할 수있는 방법이 있습니까? 불투명도를와 (과) javascript로 입력 하시겠습니까? 전반적인 불투명도에 액세스 할 수 있지만 획을 완전히 불투명하게 유지하면서 채우기의 불투명도를 낮추고 자합니다.일러스트 레이터 ExtendScript에서 선택 항목의 FILL 불투명도 설정

설명서에서 아무것도 찾을 수 없으며 다른 사람이이 질문을 할 수 없습니다.

var selection = app.activeDocument.selection; 
selection[0].opacity = 50; 

나는 이런 식으로, 내가 생각할 수있는 "fillOpacity"의 모든 변형을 시도했다 : :

나는과 같이 전체 불투명도를 설정할 수 있습니다

var selection = app.activeDocument.selection; 
selection[0].fillOpacity = 50; 
selection[0].FillOpacity = 50; 
selection[0].fill.opacity = 50; 

...하지만 작동하지 않습니다.

나는이 잘못에 대해 생각하고 있습니까? 그렇지 않습니다.

답변

4

일러스트 레이터에서도 정상적으로 액세스 할 수 없으므로 액세스 할 수 없습니다. 이 속성은 Photoshop 속성에만 있습니다. 나는 단지 문서를 확인했다. 당신이 할 수있는 것은이 생각이며 같은 일을 수행하는 것입니다 :

doc = app.activeDocument; 
i = 0 
var selection = doc.selection[i]; 
var storedColor = doc.selection[i].fillColor; 

//new object with only fill, we send it to back so it doesn't overlap stroke, if there is one 
var newObject = app.selection[i].duplicate(doc, ElementPlacement.PLACEATEND); 
//turn off fill for first object 
doc.selection[i].filled = false; 
i = i + 1; 
newObject.stroked = false; 
//apply stored color from earlier to new shape 
newObject.fillColor = storedColor; 
newObject.opacity = 50; 
newObject.name = "50p fill"; 
+0

고려하시기 바랍니다 색조 속성을 사용하여 객체에 spotcolor을 적용하는 것입니다 해결하기 위해 무슨 짓을 이것이 충분한 대답이라면 투표를하거나이 대답을 수락하십시오. – Lukasz

+0

이것은 본질적으로 제가 한 일입니다. 이것은 다른 답변과 같이 착색 된 스폿 컬러를 적용하는 것보다 "복잡합니다"라고 말하지만 색조는 이상한 일을 할 수 있으며 특히 불투명도를 변경하려고했습니다. 감사! – cr0ybot

2

나는 문제가 내가

var docRef = app.activeDocument; 
var selectedObjects = docRef.selection; 
var theTint; 
var fillwithSwatch = function (pathItems, sname){ 

for (var i=0;i< pathItems.length; i++){ 
pathItems[i].fill = true; 
theTint = pathItems[i].fillColor.gray; 
pathItems[i].fillColor = docRef.swatches.getByName (sname).color ; 
pathItems[i].fillColor.tint = theTint; 
} 
} 
theTint = fillTint(selectedObjects); 
// the spotcolor should be in the swatchpallet already 
fillwithSwatch (selectedObjects, "myBlue"); 
+0

다른 방법을 이용해 주셔서 감사합니다. 객체를 복제하는 것보다 "깨끗합니다"하지만 불투명도를 변경해야했습니다. 그래도 비슷한 상황에 다시 빠지면이 점을 명심하십시오. – cr0ybot

관련 문제