Jmol/Interactivity
From Proteopedia
Line 142: | Line 142: | ||
Before you use the template above, please remove the line breaks so that the entire command is on a single line, otherwise it does not work. | Before you use the template above, please remove the line breaks so that the entire command is on a single line, otherwise it does not work. | ||
+ | |||
+ | ===Buttons to store and retrieve orientation=== | ||
+ | |||
+ | This pair of buttons allows to save an orientation by pressing the first button, and return to the same orienation by pressing the second. Multiple pairs of these buttons allow to choreograph an animation and play it by pushing the buttons. The orientations are not saved beyond a session, though. | ||
+ | |||
+ | <jmol><jmolButton><script>view1 = script("show moveto")[11][0]</script><text>store view 1</text></jmolButton> </jmol> <jmol><jmolButton><script>script inline @{"moveto 1.0" + view1}</script><text>retrieve view 1</text></jmolButton></jmol> | ||
+ | |||
+ | <nowiki> | ||
+ | <jmol> | ||
+ | <jmolButton> | ||
+ | <script>view1 = script("show moveto")[11][0]</script> | ||
+ | <text>store view 1</text> | ||
+ | </jmolButton> | ||
+ | </jmol> <jmol> | ||
+ | <jmolButton> | ||
+ | <script>script inline @{"moveto 1.0" + view1}</script> | ||
+ | <text>retrieve view 1</text> | ||
+ | </jmolButton> | ||
+ | </jmol></nowiki> | ||
+ | |||
+ | Again, you can use a template to type less: | ||
+ | <nowiki> | ||
+ | {{subst:Store view buttons</nowiki> | ||
</StructureSection> | </StructureSection> |
Revision as of 03:17, 10 September 2020
|
Advantages
The commands issued by these interactive elements are in effect immediately, i.e. without delay. You could accomplish the same effect by saving a separate 3D scene, but this will always have a loading delay. The effect is that "playing" with interactive elements is much more immediate than switching between green links.
Caveats
The commands will be issued to the Jmol window irrespective of what is shown there. If you click on a green link elsewhere and then try the buttons etc, the effect is unpredictable. You can try this here by using the interactive elements before clicking on the button that loads the lysozyme structure. If you do that, the commands associated with the interactive elements will act on the UvrB structure instead.