### Author Topic: how to make a slider time t that allows user to slide to replay simulation  (Read 9481 times)

#### lookang

• Hero Member
• Posts: 1774
• http://weelookang.blogspot.com
##### how to make a slider time t that allows user to slide to replay simulation
« on: September 22, 2008, 01:14:45 pm »
how to make a slider time t that allows user to slide to replay simulation

is there any easy way to implement a slider bar t that will allow scrolling back in time like a movie player control for any simulation?

i notice in http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=188.msg2817#new

in slider property
variable = ts
enabled = _isPaused
on drag = dragt()

under model custom
public void dragt () {
PY1[2]=v1s=v10+a1*ts;
PY2[2]=v2s=v20+a2*ts;
x1s=x10+v10*ts+a1*ts*ts/2;
x2s=x20+v20*ts+a2*ts*ts/2;
PT[2]=PT[3]=ts;
}

this appears to be a way you designed to control the playback controller due to known equations of motion under constant acceleration.

Is there a easy way to do a playback controller for time t for any simulation that it just played ?
i was hoping maybe some library java may have it

thanks!

#### Fu-Kwun Hwang

• Hero Member
• Posts: 3062
##### Re: how to make a slider time t that allows user to slide to replay simulation
« Reply #1 on: September 22, 2008, 03:12:08 pm »
I used the equation because this is a simple case and I know the equation.
For all general type of simulations, what you need to do is make dt become negative value and you can reverse the time.
You can add code to ask the program to stop at any point you want.
So you can change direction of time when you program the simulation - You are the GOD of your simulation - you can do whatever you want with your simulation : You just need to figure a way to do it! (It is how we use our mind to make it work -- this is more important than always depend on library from others.)

#### lookang

• Hero Member
• Posts: 1774
• http://weelookang.blogspot.com
##### Re: how to make a slider time t that allows user to slide to replay simulation
« Reply #2 on: September 22, 2008, 03:36:43 pm »
For all general type of simulations, what you need to do is make dt become negative value and you can reverse the time.
You can add code to ask the program to stop at any point you want.
So you can change direction of time when you program the simulation - You are the GOD of your simulation - you can do whatever you want with your simulation : You just need to figure a way to do it! (It is how we use our mind to make it work -- this is more important than always depend on library from others.)

wow! that is a good idea for making the simulation run back in time.

but the logic is the same for silder bar ?.....hmmmmm i need to think.