Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello β I'm @olemoritz on Twitter.
Aligning scene nodes while ui sceneView is animately resized
-
@rownn said:
PS: Thought it would be clever to avoid the update method. Isnt it performance-consuming?
i thought this too before but as long as everything inside the update method does not take longer than
self.dt
your good πβΊοΈ -
When you look at the code for scene, there is an _update method that is getting called, that handles the Actions. Then it calla update. So performance wise, I think Actions and update methods are similar.
-
@JonB said:
When you look at the code for scene, there is an _update method that is getting called, that handles the Actions. Then it calla update. So performance wise, I think Actions and update methods are similar.
exactly. in my games ill actually use this to my advantage by staging animations and checks. for example you can move a node with
Action.move_by
and have a check inupdate
to make sure node isnt outside the screen. this insures the move is done before the check. Alternativily you can move your check intoScene.did_evaluate_actions()
only reason i dont use this method is because your check must wait until the action is finished and that could have been too long depending on current check being used.heres an example if anyone wants using all three steps to move the node and rmove it if off screen.
def did_evaluate_actions(self): self.move_node() def move_node(self): self.run_action(Action.move_by(-100, 0, 1.0, TIMING_EASE_IN_OUT)) def update(self): if self.position[0] < -self.size[0]-10: self.run_action(Action.remove())
adding a light rotate at the end and begining would give the rocking of a stop and go effect like in a cartoon. βΊοΈ
-
Hey guys,
amazing again. I think I will study you snippets over a glass of wine this evening :)
-
@rownn said:
Hey guys,
amazing again. I think I will study you snippets over a glass of wine this evening :)
π»
-
-
-
-
Pythonic not Pythonish. ;-) 500+ pages of results!
-
@rownn In my very old Fortan past, I used an integer 1 or 0, thus
flag = 1 - flag
-
@cvp, I vote for your version, which I plain forgot.