Measuring tube question generator

Here’s a little demo of on-the-fly image creation based on a Key Stage 1 homework my daughter brought home. Every time you visit this page you should see a different question. A new question is asked after each time you press the ‘Am I right?’ button.





This page requests a ‘measuring tube’ JSON object from the Firtl server. Server-side code selects a measuring tube template from a set of different capacities and major/minor measurement ‘ticks’, calculates a random fill that lines up nicely with one of the ticks and returns a JSON object containing the fill level and an URL for the image. The image itself is not drawn by the server until it receives the request caused by setting the img’s src attribute.

Leave a Reply

Your email address will not be published. Required fields are marked *