Changing Sketch Color after response

I’m trying to ask three consecutive questions on a sketch screen and have students respond with different colors for each one.

This is the CL I tried:

initialColor:
when R1.submitted
colors.green
when R2.submitted
colors.purple
otherwise
colors.red

It starts RED, then changes to GREEN after one response submitted, but then does not change to PURPLE.

Ideas?

when/otherwise always stops at the first true condition, so when R2 is submitted it doesn’t matter because R1 is already submitted so it doesn’t get that far.

If they have to submit R1 before they can submit R2, then you can just swap the order around. Otherwise, you’d need something like

when (R1.submitted and not(R2.submitted)) colors.green ...
1 Like

Thanks so much.
It just hit me, and I came back here to respond - I forgot about the “ordering” of the when/otherwise :wink:

You can’t conditionally change the initial (anything) after it’s set the first time. Initial is initial.

You could have separate sketches set with the backgrounds of the others, and conditionally hide them, each having their own initial color.

It actually worked to use:

initialColor:
when R2.submitted
colors.purple

when R1.submitted
colors.green

otherwise
colors.red

I have a series of three “cascading” prompts, where the second one appears after the first response (R1) is submitted, and then the third appears after the second response (R2) is submitted. The color change is so that students “show” their response in a different color, but on the same sketch, each time (red, then green then purple.)

I wasn’t sure about the “initial” part either, but it changed automatically :slight_smile:

Interesting. The same doesn’t hold for initialLatex. I wonder if it still works if you change the color manually before submitting.