From: Robert H. <ha...@st...> - 2009-11-28 00:45:13
|
When an applet has sync on, then it receives messages from any other applet on its synchronization set. By default, this set is all the applets on its page. But you can be more specific than that by using jmolSetSyncId(n) where n is some number. So set n to one number just before the jmolApplet() command for the two applets you want synchronized and set it to another number for the other two. It is important to have a random number here -- don't just use 1 and 2, or if the user loads the same page twice, all the applets with the same number (even if on different pages!) will be synchronized. I recommend using set syncmouse true;set syncscript false if all you want to do is make sure the rotation is kept the same. Thus: <script src="jmol/Jmol.js" type="text/javascript"></script> <script type="text/javascript"> jmolInitialize("jmol"); jmolSetAppletColor("white"); jmolSetSyncId(Math.random()) jmolApplet(400, "script jmolscripts/0.jmol", "0"); </script> <script src="jmol/Jmol.js" type="text/javascript"></script> <script type="text/javascript"> jmolInitialize("jmol"); jmolSetAppletColor("white"); jmolApplet(400, 'script jmolscripts/0a.jmol;sync * on;sync * "set syncMouse on;set syncScript off";' , "1a"); </script> <script src="jmol/Jmol.js" type="text/javascript"></script> <script type="text/javascript"> jmolInitialize("jmol"); jmolSetAppletColor("white"); jmolSetSyncId(Math.random()) jmolApplet(400, "script jmolscripts/1.jmol", "1"); </script> <script src="jmol/Jmol.js" type="text/javascript"></script> <script type="text/javascript"> jmolInitialize("jmol"); jmolSetAppletColor("white"); jmolApplet(400, 'script jmolscripts/1a.jmol;sync * on;sync * "set syncMouse on;set syncScript off";' , "1a"); </script> On Fri, Nov 27, 2009 at 11:59 AM, Julia Fischer <jul...@eb...>wrote: > Hi, > > I have 4 applets (jmolApplet0, jmolApplet0a, jmolApplet1, jmolApplet1a), > and I would like to synchronize 0 with 0a (both as drivers) and 1 with 1a > (both as drivers), but the 0s should rotate independent from the 1s. My code > is below, but for some reason all 4 applets rotate around the same centre of > gravity all together when I move one. Interestingly the choice of the centre > of gravity depends on which applet I click on first. > > What am I doing wrong? Please help. > > Julia. > > -- > Julia Fischer > EBI - Thornton group (jul...@eb...) > > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > > -- Robert M. Hanson Professor of Chemistry St. Olaf College 1520 St. Olaf Ave. Northfield, MN 55057 http://www.stolaf.edu/people/hansonr phone: 507-786-3107 If nature does not answer first what we want, it is better to take what answer we get. -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900 |