# Hiding an Image Until a Condition is Met

**URL:** <https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042>\
**Category:** Questions\
**Created:** [May 19, 2020, 8:55am UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042 "2020-05-19T08:55:13Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davy\_B](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/davy_b/32/3264_2.png) [@Davy\_B](https://cl.desmos.com/u/Davy_B)\
**Post date:** [May 19, 2020, 8:55am UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/1 "2020-05-19T08:55:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cwinske](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwinske/32/3106_2.png) [@cwinske](https://cl.desmos.com/u/cwinske)\
**Post date:** [May 19, 2020, 11:42am UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/2 "2020-05-19T11:42:53Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![Davy\_B](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/davy_b/32/3264_2.png) [@Davy\_B](https://cl.desmos.com/u/Davy_B)\
**Post date:** [May 19, 2020, 3:46pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/3 "2020-05-19T15:46:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Davy\_B](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/davy_b/32/3264_2.png) [@Davy\_B](https://cl.desmos.com/u/Davy_B)\
**Post date:** [May 19, 2020, 4:00pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/4 "2020-05-19T16:00:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cwinske](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwinske/32/3106_2.png) [@cwinske](https://cl.desmos.com/u/cwinske)\
**Post date:** [May 19, 2020, 4:00pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/5 "2020-05-19T16:00:47Z")

</div>

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.

```auto
bounds: makeBounds(-5,5,-5,5)

```

---

<div class="post-metadata">

**Author:** ![Davy\_B](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/davy_b/32/3264_2.png) [@Davy\_B](https://cl.desmos.com/u/Davy_B)\
**Post date:** [May 19, 2020, 4:05pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/6 "2020-05-19T16:05:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![estepj](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/estepj/32/1232_2.png) [@estepj](https://cl.desmos.com/u/estepj)\
**Post date:** [November 3, 2020, 5:52pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/7 "2020-11-03T17:52:42Z")

</div>

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.

> **[Angle Relationships: Complementary, Supplementary, Vertical, and Adjacent •...](https://teacher.desmos.com/activitybuilder/custom/5f9c303afc2e390b4dcb9843)**
>
> This activity will help students work with special angle pairs: complementary, supplementary, vertical, and adjacent angles. Students also practice with acute, right, and obtuse angles. Students will solve for missing angle values, analyze a...

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [November 3, 2020, 6:27pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/8 "2020-11-03T18:27:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![estepj](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/estepj/32/1232_2.png) [@estepj](https://cl.desmos.com/u/estepj)\
**Post date:** [November 3, 2020, 6:33pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/9 "2020-11-03T18:33:32Z")

</div>

Finally -thanks!

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

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [November 3, 2020, 7:22pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/10 "2020-11-03T19:22:46Z")

</div>

How about this?

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

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [November 3, 2020, 7:30pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/11 "2020-11-03T19:30:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![estepj](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/estepj/32/1232_2.png) [@estepj](https://cl.desmos.com/u/estepj)\
**Post date:** [November 3, 2020, 8:09pm UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/12 "2020-11-03T20:09:14Z")

</div>

FINALLY! Thank you =)

---

<div class="post-metadata">

**Author:** ![Sarah\_Lanahan](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sarah_lanahan/32/871_2.png) [@Sarah\_Lanahan](https://cl.desmos.com/u/Sarah_Lanahan)\
**Post date:** [June 3, 2022, 2:13am UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/13 "2022-06-03T02:13:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sarah\_Lanahan](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sarah_lanahan/32/871_2.png) [@Sarah\_Lanahan](https://cl.desmos.com/u/Sarah_Lanahan)\
**Post date:** [June 3, 2022, 2:30am UTC](https://cl.desmos.com/t/hiding-an-image-until-a-condition-is-met/1042/14 "2022-06-03T02:30:21Z")

</div>

JK found it! If anyone else is looking for it you can find the thread with how to do it [here](https://cl.desmos.com/t/action-button-reveals-graph/278)
