You need to set some conditional cases on the Panel State Changed event because you want to do something different when the state is “Push” versus “Pull”. As it is now, the same actions happen every time the panel changes, but they never get “reset”. So the animation works on the first state change (to Push), but both sets of widgets get resized, so on the next state change (to Pull) the widgets are already at the size you set them in the first state change, so the dimensions don’t need to change, thus no animation is seen. Then, every state change after that there remains nothing that needs to be resized.
This updated file has a quick fix:
Panel state animated transition.rp (87.5 KB)
in Page 2b, there are two cases. Each case sets the widgets in the current state to a “big size” and resets the widgets in the other state to their default size, so that when the state later changes the widgets actually change size and thus the animation is shown
-
Case 1
If state of This equals Push
Set Size
push rec to (big size) swing 230ms
ellipse to (big size) swing 230ms
Set Size
Pull rec to (default size) // no need to animate because these are in another state
(pull) ellipse to (default size)
-
Case 2
If state of This equals Pull
Set Size
Pull rec to (big size) swing 230ms
ellipse to (big size) swing 230ms
Set Size
push rec to (default size)
(push) ellipse to (default size)
So, that’s how to do this with dynamic panel states. Of course if you only need to resize the same exact widgets and no different widgets need to exist in the various states, you don’t need (or really want) a dynamic panel with duplicated widgets (more overhead to create and maintain, more likelihood for mistakes), just resize the same widgets directly. This is shown in Page 2c, just in case.