Hiding an Image Until a Condition is Met

I’d like to hide an image (e.g. a solution) until a condition has been met (e.g. student has attempted the question). Any suggestions?

Toss the image in a graph. It usually defaults to the center at the origin, so change it to (0,0{C=1}). This means it will only appear when the C variable is equal to 1.

Then in the graph, create a number sink based on the correct answer. Something like this would work, as an example:

number("C"): when input.submitted and input.numericValue=8 1 otherwise 0

Thanks. Getting there! Great, the image disappears until a condition is met but:

  1. Can I get rid of the graph background so that it looks like an image?
  2. The image is currently much smaller than it would be in an image screen. Can I fix that?

…sorry, now see how to get rid of the background!

When you open the graph, click on the wrench icon on the right side to turn on/off the grid and axes. Two ways to adjust the image:

  1. In the graphing calculator, you can change the width and height of the image within the left panel.
  2. In the graph gear, adjust the bounds using CL. This will only show -5 to 5 in both the x and y axis.
bounds: makeBounds(-5,5,-5,5)

Thanks, we are there now! I have a computing background but only started with CL last week so still learning.

This still isn’t working for me. On slide 6, i want the image to appear after a student makes a selection. Is that possible?

Also - no matter what I put in the CL I cannot get slide 13 to work for me. I only want the multiple choice to show up when the correct answer is chosen, but the options are there no matter what choice you pick.

Try this instead:
hidden: when but2.pressCount>0 and choice.isSelected(1) false otherwise true

Your original would only hide if the button hadn’t been pressed AND choice 1 wasn’t selected. (You could also just change your original to or instead of and I think.) Also, the hidden sink for the second multiple choice is missing the second condition.

Finally -thanks!

Any advice on hiding the image on slide 6 @Daniel_Grubbs?

How about this?

hidden: when (Choice2.isSelected(1) or Choice2.isSelected(2)) and sketch1.sketch.strokeCount>0 false otherwise true

1 Like

Also, the picture in Slide 13 is HUGE. Maybe put it into a graph so you can resize it.

You might also consider setting the initial tool in the sketch for slide 6 to the line tool:
initialTool: sketchTools.line

And then use a stroke count greater than 1 for the hidden sink I shared before.

FINALLY! Thank you =)

Is there a way toggle the sketch for checking on and off? Other than listing out a bunch of options for the button press count? It would be nice to be able to do when button.presscount = n 0, when button.presscount=(n+1) 1

JK found it! If anyone else is looking for it you can find the thread with how to do it here