nglviewer / nglview

Jupyter widget to interactively view molecular structures and trajectories
http://nglviewer.org/nglview/latest/
Other
824 stars 134 forks source link

Transparent shapes #1118

Open alexberlaga opened 3 months ago

alexberlaga commented 3 months ago

Is there a way to make an added shape have some transparency? I tried changing the color to a 4-element list, but that didn't work:

view.shape.add_sphere(zcc_point * 10, [1, 0, 1], 1)
view.shape.add_cone(point_a * 10, zcc_point * 10, [1, 0.5, 0], 10)
hainm commented 3 months ago

I am wondering if opacity=0.5 will work view.shape.add_sphere(zcc_point * 10, [1, 0, 1], 1, opacity=0.5)

I don't have access to nglview now so I am not sure.

alexberlaga commented 3 months ago

Unfortunately, it does not: Shape._make_func.<locals>.make_func.<locals>.func() got an unexpected keyword argument 'opacity'