You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function highlightFrom(start) {
return new pv.color.ColorOp(function(atom, out, index) {
if (atom.index() > start) {
out[index+0] = 1.0; // R
out[index+1] = 0.0; // G
out[index+2] = 0.0; // B
out[index+3] = 1.0; // A
} else {
out[index+0] = 0.0;
out[index+1] = 1.0;
out[index+2] = 0.0;
out[index+3] = 0.5;
}
});
}
viewer.forEach(function(go) {
go.colorBy(highlightFrom(50));
});
(As a side note, convention out[index+1] is begging for some description in docs; it wasn't intuitive for me and it took me some time guessing; at least comments (this // R // G // B // A) would be really nice.)
However, opacity does not work as intended: (i.e. it rather mixes with white than makes thing semi-transparent):
Is there way to make parts of a structure transparent or semi-transparent (either with colorBy or something like setOpacity)? (Setting opacity would be even nicer, as I don't intend to change a color.)
The text was updated successfully, but these errors were encountered:
I believe you are experiencing the problems outlined here: #55. The part of the geometry you are highlighting (N-term) is always rendered before the rest of the protein. It would work correctly for the C-term.
I've started implementing a special highlighting pass in a local branch a while ago (see screenshot) It essentially abuses the alpha color channel for implementing a glow around the selected part. If there is interest, I can spend some time to get it ready for prime-time.
I agree, the docs are not very clear on what the indices mean. I'll update them to make it clearer.
I wrote:
(As a side note, convention
out[index+1]
is begging for some description in docs; it wasn't intuitive for me and it took me some time guessing; at least comments (this// R // G // B // A
) would be really nice.)However, opacity does not work as intended: (i.e. it rather mixes with white than makes thing semi-transparent):
Is there way to make parts of a structure transparent or semi-transparent (either with
colorBy
or something likesetOpacity
)? (Setting opacity would be even nicer, as I don't intend to change a color.)The text was updated successfully, but these errors were encountered: