NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
October 24, 2014, 08:23:42 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Teaching without words. ...Lao Tzu (570-490 BC)
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: Physlets An attempt at bar magnet using physletbuilder java applet  (Read 5297 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
on: September 02, 2008, 10:51:27 am » posted from:Singapore,,Singapore

 name="AppletNames" value="Bfield">






* physletsmagnetic.PNG (40.77 KB, 643x523 - viewed 56 times.)
« Last Edit: July 25, 2009, 10:54:56 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3057



WWW
«
Embed this message
Reply #1 on: September 09, 2008, 02:32:38 pm » posted from:Taipei,T'ai-pei,Taiwan

I copied the same code here:


 name="AppletNames" value="Bfield">



The javascript code is the following:
var timerID2=0;
function initApplets2(){
 clearTimeout(timerID2);
 loaded2=true;
 timerID2=setTimeout("init2()",100);
}
function init2(){
 fkh2=document.Bfield2;// define id for the physlet applet
 fkh2.setAutoRefresh(false);
 fkh2.setDefault();
 id=new Array(18);
 x1=0;
 id0=fkh2.addObject("coil","x=0.0,y=0.0,i=0,r=0.1");// no current, just for drag effect
 for(i=0;i<18;i++){
  param="x="+x1+",y=0,i=1,r=0.1";
  id[ i ]=fkh2.addObject("coil",param);
  x1+=0.02;
 }
 fkh2.setDragable(id0,true);
 fkh2.setAutoRefresh(true);
}

function movetodrag(){
 x2=fkh2.getXPos(id0);
 y2=fkh2.getYPos(id0);
 for(i=0;i<18;i++){
  fkh2.setXPos(id[ i ],x2);
  fkh2.setYPos(id[ i ],y2);
  x2+=0.02;
 }
}

And the button just call movetodrag()!
Logged
Pages: [1]   Go Up
  Print  
Teaching without words. ...Lao Tzu (570-490 BC)
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Induced voltage by shaking a magnet through a solenoid applet request
Request for physics Simulations
entomopter 9 12071 Last post June 09, 2008, 11:43:59 pm
by Fu-Kwun Hwang
Physlets Electric field lines one positive and one negative charge java applet
Collaborative Community of EJS
lookang 12 15777 Last post November 11, 2008, 08:58:28 pm
by Fu-Kwun Hwang
Physlets Electric field lines generated by two positive charges java applet
Collaborative Community of EJS
lookang 0 7719 Last post August 18, 2008, 03:44:31 pm
by lookang
Physlets Electric field lines generated by two negative charges java applet
Collaborative Community of EJS
lookang 0 10240 Last post August 18, 2008, 09:30:37 pm
by lookang
Physlets Optics java applet: A simple object on the left of the lens and a lens
Collaborative Community of EJS
lookang 0 6944 Last post September 02, 2008, 01:47:38 pm
by lookang
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.052 seconds with 24 queries.since 2011/06/15