lookang lawrence wee
Created Apr 11, 2024Tutorial 1 for Workshop 18-24 July: Creating a Simple Ball Simulation With ChatGPT and WebEJS
🌟
Building a simulation using ChatGPT3.5 (initial variables and scaffolds) with WebEJS (power customisation to meet designer's and users' needs).
Let's create a simple ball moving to the right as an idea for this tutorial :)
Prompt 2: Refine based on what GPT gives.Add on to the previous message by pasting (ctrl+v) what was copied:"Define the parameters of the simulation:- Initial position of the ball.- Initial velocity of the ball.- Acceleration (if any).- Time step for the simulation."
Responses from ChatGPT may not always be exactly the same. There are times when words are phrased differently with the same concept.
E.g., it could also be in a form of a sentence like "Define parameters such as initial position, initial velocity, acceleration, and time step." to copy (ctrl+c) and paste (ctrl+v)

Refer back to ChatGPT and copy the rest of the variables required.Our current focus to copy over is "v0", where it is initiated with 10 as the value.
After copying "x0", what's left are:
v0, a, dt, t, x & v.
Jump to the next major step (#31) after filling up all the required variables:

#
WebEJS 1.0beta
#
WebEJS 1.0beta
After copying "v0", what's left are:
a, dt, t, x & v.
Jump to the next major step (#31) after filling up all the required variables:

#
ChatGPT
Refer back to ChatGPT and copy the rest of the variables required.Our current focus to copy over is "t", where it is initiated with 0 as the value.
After copying "a", what's left are:
dt, t, x & v.
Jump to the next major step (#31) after filling up all the required variables:

Refer back to ChatGPT and copy the rest of the variables required.Our current focus to copy over is "dt", where it is initiated with 0.1 as the value for the Time Step.
After copying "t", what's left are:
dt, x & v.
Jump to the next major step (#31) after filling up all the required variables:

Refer back to ChatGPT and copy the rest of the variables required.Our current focus to copy over is "x" & "v", where it is initiated with 0 as the value.
After copying "dt", what's left are:
x & v.
Jump to the next major step (#31) after filling up all the required variables:

🌟
Implementing the motion
🌟
Crafting Plotting Panel View with HTML
Now we want to shift the "controlPanel" (in Green) to the top of the page.
To do this, we will have to shift the "controlPanel" to inside "labelPanel", as indicated with the Red markings.

Sometimes WebEJS might end up creating 2 Shapes instead. Delete the extra 2nd element by clicking on the shape icon here.
If this doesn't occur in your case, skip to step #60 here:

🌟
PREVIEW: the simulation
The simulation should look like this as a result.
The ball is moving to the right at a speed of (dx/dt = v = v0 = 10)
^ may go to variables to change v0 = 0.6 or any other desired value to slow the speed.

^ may change the velocity value, v0 to "0.6" for a slower motion.

🌟
use Model - Evolution
Go to the "Model" tab under "Evolution".
The simulation should look like this as a result.

Congratulation! You have successfully crafted a simulation :) Feel free to explore more features of WebEJS before proceeding to export the simulation file.
🌟
Exporting the file
After Extracting the file, click on "simulation.xhtml" to open up the simulation on your default browser.

Click on this link to cross-reference your work with tutorial simulation!
Congratulation! You have come to the end of the tutorial :)
Hope you enjoyed the process 😄 Do play around with WebEJS at your own time to discover more features it has.