Animate image based on student response

I want to make an imbedded image spin based on student responses. This is what I have so far (I’m messing around with NOT my final activity)

I can make the cat spin by going into edit graph and clicking the play button. I want it to spin if I press “yes” in multiple choice.

Hi Camille, welcome to the forum!

I would do this by setting a graph variable (using the number sink in the graph component) with the timeSinceSubmit sink from the multiple choice component. In order to access the timeSinceSubmit from the graph component, you’ll need to give the multiple choice component a name so it can be referenced in the graph (I called mine mult_answer).

Using this plus some conditionals, the following line of code (added to the CL of the graph component) will make a variable t in the CL graph which will go from 0 to 1 after the student hits submit if the student selects the first answer (“yes”). The variable t can then be used in the Desmos graph to determine the rotation of the cat, making it rotate when the variable changes value!

number("t"): when mult_answer.isSelected(1) mult_answer.timeSinceSubmit(1) otherwise 0

I’ve made a copy of your activity ([Copy of] Learning • Activity by Andrew) with the example edits made in case that’s helpful!