When building molecular animations, modelers often come across a common challenge: controlling what should be shown and what should remain hidden. Precision matters when conveying dynamic molecular interactions, and toggling visibility is essential for clarity, storytelling, and analysis. Luckily, the Node Specification Language (NSL) in SAMSON offers a concise way to handle this.
In this post, we explore how the visible and hidden attributes can help you fine-tune what appears in your molecular animations using NSL’s an (animation) attribute space.
Why Animation Visibility Matters 🎬
Animations of molecular processes—like protein folding, docking, or reaction pathways—often involve multiple steps with different structures or annotations. Being able to focus viewer attention by hiding or showing specific parts of the scene can improve communication dramatically.
SAMSON offers flexible tools to manage visibility via attributes defined in the an attribute space, which applies specifically to animation nodes.
Key Attributes for Visibility Control
The relevant visibility-related attributes in the an space include:
an.v(visible): Shows whether an animation node is visible.an.h(hidden): The inverse of visibility.an.vf(visibilityFlag): Explicit control over visibility evaluation by flags.
Practical Examples
Suppose you’re working on an animation where one molecular domain appears gradually. Using NSL, you can interactively select only the nodes of interest:
- To find all currently visible animation nodes:
an.v - To filter hidden animation nodes:
an.h - To exclude hidden nodes explicitly:
not an.h - To toggle visibility using a script or search:
an.vf false
Even better, using the short codes can help keep things concise and readable, especially when building more complex selection queries.
What’s the Difference Between visible and visibilityFlag?
While both relate to visibility, an.v returns whether the node is currently visible based on a combination of internal factors (like user interface state and flag values), whereas an.vf lets you control the flag directly.
For example, even if an.vf is false, other conditions might still make the node visible—so use an.v for checking actual visibility status, and an.vf if you want to enforce a rule.
Combining Attributes for Advanced Control
You can combine multiple attributes using logical operators to refine your selection further. For instance, if you’re animating a segment named “LoopA” and want to isolate it only if it’s visible:
|
1 |
an.n "LoopA" and an.v |
This combines name matching with a visibility check, offering a powerful way to target specific elements in your scene with precision.
Save Time with Better Filters
By proactively using these attributes in your queries or scripts, you can make your molecular animations clearer, troubleshoot display issues quicker, and better control what viewers see—improving both presentation and analysis workflows.
To learn more about these attributes and others available in the animation context, visit the full documentation here: https://documentation.samson-connect.net/users/latest/nsl/animation/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON and explore its extensible platform and molecular design tools at https://www.samson-connect.net.
