Hey everybody,
Is there a way to change the transparency of a particular graphic or is this only possible for a graphic layer?
Tim
Hi Tim,
If the graphics is already created, you can use the setSymbol method to do this. Ex:
var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]), 2),new Color([255,255,0,0.25]) ) map.graphics.graphics[2].setSymbol(symbol);
Thanks Jake!
You can change the transparency of the color you assign different graphics.
var trans = Math.random(); // lineSymbol used for freehand polyline, polyline and line. var lineSymbol = new CartographicLineSymbol( CartographicLineSymbol.STYLE_SOLID, new Color([255, 0, 0, trans]), 10, CartographicLineSymbol.CAP_ROUND, CartographicLineSymbol.JOIN_MITER, 5 );
One more question, how does this work if my color is in Hex string?
According to the documentation, the transparency option is only available for RGB colors
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.