SVGs for color-based quiz

Intro

Being able to use SVG’s, for which you can limit the clickable area to the SVG itself, creates a lot of opportunities. In a recent post I explained how you can use them for a custom Hotspot question. 

This time I played with Flags, in Europe a lot of national flags have a cross embedded. Play with this example file. After the title slide which has some explanation, you have to color 5 knowledge check slides, Have fun. 

Small warning: if you are on a small screen, you may have to insist to color the small parts (especially on the UK slide). The part is really clicked when you have seen it shrink. You can play from this link (scalable HTML) or with the embedded version (fixed size):

Setup

You’ll find details about the setup,with topics:

  • Objects (including timeline)
  • Variables and Events
  • Advanced actions
  • Shared action (has been used 47 times)

Objects – timeline

Have a look at the Timeline of slide 2 which is the first quiz slide (flag 1, Denmark):

From bottom to top you see:

  • SS_Proback1: (smart shape) the white background of the progress bar (bottom left). Since the flags have different amounts of parts, I preferred to have an individual background on each flag slide, whereas
  • SS_Progress: (smart shape) progress bar is timed for the rest of the project. It has a normal state which is invisible (no Alpha nor stroke), and a state for each added green star, totals 18 states but not all states are used on each slide.
  • Gr_Denmark: has all the flag parts, on this slide 5. All parts are SVG’s used as buttons with the default pausing poins at 1.5secs. Each SVG has 3 object states: Normal (with a black pattern), Correct (colored), Wrong (Gray tint). Here is the screenshot with object states for the Cross part of the UK flag:
  • Gr_Colors: group with 5 colors, timed for the rest of the project because same colors are used for all flags. Colors are shape buttons, default pausing point at 1.5s. They have 3 states: Normal, Current and Dimmed. Here a screenshot for the Red smart shape.
  • Country_DK: country name (text)
  • SB_Next: shape button timed for the rest of the project, no pausing point, with 3 InBuilt states (Normal, Rollover, Down)
  • Title

Variables and events

Three user variables are created for the actions:

  • v_color: will store the name of the color chosen from the color shapes; the exact names are needed which are Blue, DarkBlue, Red, White and Yellow.

  • v_counter: will track the number of correct flag parts which have been colored (is equal to the number of stars displayed by the progress bar).

  • v_max: the number of flag parts to be colored. For the first two flag slides this is 5, for the two following slides it is 9 and the last flag slide has 17 parts.

I didn’t provide a replay course button at the end, to limit the number of events and actions. The used events  are:.

  • On Enter slide event for all flag slides. They trigger a similar advanced action, depending on the number of flag parts: 'Enter5' (first two flag slides), 'Enter9' (two following slides) and 'Enter17 'for the UK slide.

  • On Enter slide event for the End slide triggers 'EnterEnd'.

  • Success event for the Color shape buttons trigger a similar advanced action 'Blue_Act', 'DarkBlue_Act', 'Red_Act', 'White_Act' and 'Yellow_Act'.

  • Success event of the SVG’s which are the flag parts (used as buttons), trigger all the same Shared Action 'FlagAct'.
I will explain why I choose for advanced or shared actions for those events.

Actions

Enter5Act/Enter9Act/Enter17Act (advanced actions)

Those very similar actions are triggered On Enter of the flag slides, depending on the number of flag parts. Here is a screenshot of 'Enter9Act':

You see it is mainly a Reset action. Because the color shape buttons are timed for the rest of the project, it is necessary to reset their state to Normal when entering a new slide.  That wouldn’t have been the case if I had repeated the colors on each slide, and left the option ‘Retain state …’ unchecked. However such a setup would have complicated the actions a lot more, than using this advanced action On Enter. The actions for 5 and 17 parts are almost identical, only the value of the variable v_max will change (command marked in red in screenshot). Because of the limited number of actions (3), and the fact that only one command had to be edited,  I prefer duplicate advanced actions over a shared action with multiple parameters.

EnterEnd

This simple action will hide several items which were displayed for the rest of the project and no longer necessary on the Congratulations slide:

Blue_Act, DarkBlue_Act, Red_Act, White_Act, Yellow_Act

These advanced actions are triggered by the success event of the color shape buttons.

The 5 actions are also very similar, here is the screenshot of the Red_Act:

I could have used a shared action, but preferred duplicate advanced actions. Four of the color buttons need their state to be changed to Dimmed, the active clicked button to Current and its color has to be entered as value for v_color.

It is very simple to duplicate the actions for the other colors, and change the first command and switch one dimmed and current state to adapt the action to the new active button.

FlagAct

Shared action triggered by the Success event of the flag parts (SVG used as button). In older versions than 11.5 this setup would not have been possible since many bounding boxes are overlapping. The shared action, which I used 47 times, looks like this:

I indicated the 6 parameters by a color code. Four of them are always the same, but they are compulsory, need to be parameters (Progress bar, Next button, Wrong and Correct states). Only the color and the flag part are important to set up correctly. A good labeling system for the flag parts can help. You may have seen that I took care of labeling in a consistent way.

Conclusion

Hope this example releases your creative ideas for similar use cases, both for adult learners and (of course) kids.  It would be great if you commented about that. Or do you have questions, suggestions?

5 responses
Hi Lieve, Yet another blog from you! You are tireless… May I point out grammatical error in the title? It is a common one even among many native English speakers: it should be “SVGs” instead of “SVG’s”, as the “s” in this case is not a possessive “s” (which would be formed with an apostrophe) but indicates the plural of SVG. Personally, I would also have written color-based and quiz in lower case, but that is only personal preference… Best wishes, Carl Von: comment-ljuci4eve0nhk2m5izvv+1450360@posthaven.com [mailto:comment-ljuci4eve0nhk2m5izvv+1450360@posthaven.com] Gesendet: Samstag, 31. August 2019 17:13 An: carl.lauer@sapiram.com Betreff: [blog.lilybiri.com - New Post] SVG's for Color-based Quiz
Sure, will make those corrections. Capitals in titles is a sour topic, but you are absolutely right about the wrong apostrophe.
Hello Cark and thanks for posting this tutorial. Would you possibly have one on creating a memory game without using SmartShapes. My work needs to be 508 compliant and the use of SmartShapes and/or the Use as Button is not allowed.
Who is Cark? I am the author of this post, and my name is Lieve
1 visitor upvoted this post.