File-derived structure Jmol-derived structure |
This page demonstrates how to synchronize applets in Jmol.
The two applets are jmolAppletA and jmolAppletB. Once the checkbox is checked, going to either one controls the other.
The command used here is simply:
Alternatively, we could have used:
|
|
Jmol version=11.3.9 # new feature: synchronization of applets using Jmol scripts: # # sync .|>|*|appletId[syncId] ON|OFF|SLAVE|command # # The sync command allows two or more applets to be synchronized in # terms of orientation. Move one with the mouse, and the other moves as well. # In addition, the sync command allows ANY command to be sent to one or more # other applets directly, without the intervention of JavaScript. # # Applets are identified by appletId (jmolApplet0, for instance) # along with an optional bracketed sync group identifier -- generally a random # number that identifies the page containing the controlling applet. If the # syncId is not given, then the ID for the page containing the controlling applet # is used. This feature is important for cross-frame synchronization only. # # # . this applet only # > all applets except this one # * all applets # appletId id of a specific applet # [syncId] (optional) a unique string of digits -- brackets included # # ON sync as driver (default) # OFF turn sync off # SLAVE turn sync on, but not as driver # command command to send # # for example: # # sync * # synchronize all applets as drivers # sync jmolApplet1 #syncs this applet with jmolApplet1 both as drivers # sync > "set echo top left;echo OK" # sends OK to top left of all OTHER applets # sync jmolApplet2[254678942] OFF # turns sync off for an applet ON A DIFFERENT PAGE # # or in a different FRAME # sync . OFF # turns sync off for this applet # # new Jmol.js feature: jmolGetSyncId(); jmolSetSyncId(id); # allows control over the sync ID via javascript. jmolSetSyncId(id) # should be called prior to jmolApplet() and should incorporate some sort of # random digits and no space characters. (A number is good.) # This should only be necessary for multi-frame pages. # ----------------------------------------------------------------------------- |