APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

How use conditions in ejs? post and replies

Return to the How use conditions in ejs? thread
Login to post to this thread

how to make a ball following the line of a square?
Otavio Neves
7 Posts

I need to do a simulation of electrical circuit, it would insert balls representing the electrons flowing through the circuit, however I can only make the ball swing from side to side. How do I follow the line of the ball made??? Attached is what I have done.


Replies to how to make a ball following the line of a square?

how to make a ball following the line of a square? -
Otavio Neves
7 Posts

hey experts, someone could help me?



Re: how to make a ball following the line of a square? -
Francisco Esquembre
237 Posts

a) there is no simulation attached (is it?)


b) you need to code the position of the balls to follow the coordinates of the curve you want (in particular that of a square).



Re: Re: how to make a ball following the line of a square? -
Otavio Neves
7 Posts

Attached simulation in .ejs and .jar, both are compressed into a single .rar file.

Attached File: Simulationejsandjar.rar



Re: Re: Re: how to make a ball following the line of a square? -
lookang Avatar
lookang
245 Posts

professor fu-kwun hwang has a model that models an array of particles moving as if like electrons using an optical illusion in a 3D wire. enjoy!

http://iwant2study.org/lookangejss/05electricitynmagnetism_22electromagneticinduction/ejs/ejs_model_DCmotor10.jar http://iwant2study.org/lookangejss/05electricitynmagnetism_22electromagneticinduction/ejs/ejs_src_DCmotor10.zip

description

http://iwant2study.org/lookangejss/05electricitynmagnetism_22electromagneticinduction/ejs/ejs_src_DCmotor10.html

 

Post edited October 7, 2014 at 10:45 AM EST.

Post edited October 7, 2014 at 10:46 AM EST.


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: Re: how to make a ball following the line of a square? -
Otavio Neves
7 Posts

lookang, thank you, but I just need a simple circuit like I did and posted. I need to know how to make the ball placed at the end of the line disappears and the other sphere to appear in an instant, giving the impression that this sphere circling the wire. The sphere represents the electron in the circuit. For this I thought of using conditions, like programming, using (if) for example, but do not know how to do this.



Re: how to make a ball following the line of a square? -
Otavio Neves
7 Posts

Does anyone know what I need to do?



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book