To have the actions flow, you could reference the same custom attribute, then add conditions to activate at certain points. The attached example has a attribute called step, you then could use 'if" or smallest or largest conditions SOFA BED.skp (73.0 KB)
put the “step” attribute and the onclick in the parent “both” then reference that to the two nested with conditions to create the movement , as it is homework, you would need to figure those formulas out using the example above as a guide