Here is another version of this idea. It is simplified as in:
- It allows only one revealer per scene or (and this is new) symbol
- groups or elements to be revealed can only reside on the top level of either a scene or symbol and must contain the class name
revealer
and a unique class name (for examplered
) - all groups are initially hidden. Only if the class name
default
is added are they initial visible - to create a reveal trigger, add
data-revel
with the value of the group to reveal likegreen
Simple setup demo:
Custom behavior signals (optional)
- Each trigger action emits a custom behavior called like the group name (for example: clicking on a button with data-reveal set to
group2
would additionally emit the behaviorgroup2
. If the trigger resides in a symbol, the custom behavior is prepended by the symbol name (for example: if the symbol name isSymbol
and the triggergroup2
the custom behavior would beSymbol group2
.
Nested setup
A simple nested example is included in the download as well:
This version is easier to grasp if only used in a scene and straightforward to nest, using symbols as the container for a specific logic.
Download:
Revealer.hype.zip (59,0 KB)