UXInteract / task_043 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
2.12 kB
# Simulate two falling objects
Build an offline science demonstration in `index.html`. Put experiment settings to the left, a canvas with two distinguishable falling objects to the right, and start/reset controls and landing results below.
## Controls and state
- Use `#typeA` and `#typeB` for `ball` or `feather`, `#vacuum` for the vacuum checkbox, and numeric range controls `#drag`, `#gravity` and `#weight`. Show their values in `#dragVal`, `#gravityVal` and `#weightVal`. Use `#start`, `#reset`, `#scene` and `#result` for buttons, canvas and result.
- Expose `window.gameTest` with `reset(config)`, `step(milliseconds)` and `state()`. Configuration is `{types:[typeA,typeB],vacuum,drag,gravity,mass}`; the weight control sets `mass`. State is `{objects:[{height,velocity,landed,landingTime}],config:{vacuum,drag,gravity,mass}}` with one object entry per selector. Height is pixels above ground, falling velocity is positive, and landing time is in seconds or null before landing. Reset and step return the resulting state.
- Set object types at reset; other controls update the active simulation during the fall. Injected and manually selected settings must agree with the displayed controls.
## Acceptance Checklist
- Start both objects from the same height. In a vacuum their trajectories and landing times match regardless of type or mass, and zero drag produces the same result. More gravity shortens a vacuum fall. In air, higher drag delays a fall, the feather is affected more than the ball, and higher mass reduces the delay. The ordinary comparison settings (mass 1–5, gravity 9.8, drag 0.01–0.08) allow both objects to land within 20 seconds.
- Use shared 50 ms simulation updates for manual and animated execution. Preserve partial elapsed time between manual calls; the start button uses real elapsed time rather than assuming a frame rate.
- The canvas and results reflect state changes in both modes. Give each landed object's time to two decimal places. Reset stops animation, clears accumulated time, velocities and landing results, and returns both objects to their starting height.