Opacity?

870 views
Skip to first unread message

Sai Asuka

unread,
Feb 22, 2015, 12:18:39 PM2/22/15
to cesiu...@googlegroups.com
Is there such thing as opacity for geojson data source and/or entity/primitive styling?

I don't see anything related to it here:

Sai Asuka

unread,
Feb 22, 2015, 1:17:52 PM2/22/15
to cesiu...@googlegroups.com
Say for example I have a cube with a poly line inside of it. So I want to adjust the fill opacity of the cube so I can see the polyline.
--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

OHTSUKA Ko-hei

unread,
Feb 22, 2015, 5:37:26 PM2/22/15
to cesiu...@googlegroups.com
Color attribute which is instance of Cesium.Color has an alpha channel.


2015/02/23 3:17、Sai Asuka <asuka...@gmail.com> のメッセージ:

Hyper Sonic

unread,
Feb 22, 2015, 5:50:00 PM2/22/15
to cesiu...@googlegroups.com
Ya, check out the Sandcastle here
it makes 5 translucent boxes each with this code (line 129) alpha being the opacity
    entities.add({
        position
: Cesium.Cartesian3.fromDegrees(-106.0, 45.0, height),
        box
: {
            dimensions
: new Cesium.Cartesian3(10000.0, 90000.0, 90000.0),
            outline
: true,
            outlineColor
: Cesium.Color.WHITE,
            outlineWidth
: 2,
            material
: Cesium.Color.fromRandom({alpha : 0.5})
       
}
   
});


Matthew Amato

unread,
Feb 22, 2015, 7:50:46 PM2/22/15
to cesiu...@googlegroups.com

There are two ways to do it. You can configure the default stroke and fill for all features at load time; or you can modify the color of specific features after loading is done (the above example does both). As already mentioned, colors in Cesium have an alpha channel. There's a lot of ways to specify a Color, so I would also check out the Color documentaiton: http://cesiumjs.org/Cesium/Build/Documentation/Color.html.  "withAlpha" is probably the easiest if you want a known color name (Cesium.Color.RED.withAlpha(0.5)



Sai Asuka

unread,
Feb 22, 2015, 10:18:20 PM2/22/15
to cesiu...@googlegroups.com
Thank you, this is very clear.
Reply all
Reply to author
Forward
0 new messages