I am just starting to experiment with scenes and I have a question. I have drawn a complex shape (e.g. a car) using lines, rects and ellipses on the scene. If I want to animate the whole shape with a sequence of rotate, scale, translate, how should I go able that? I tried layers, but it does not support drawings functions on the layer itself. Appreciate any pointers.
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.
Best posts made by echen
-
Animation of complex objects
-
RE: ui.webview and authentication
Thanks for the replies, both suggestions worked.
Latest posts made by echen
-
RE: Animation of complex objects
thanks I guess my problem is I am not getting the concept right. Love to see a tutorial, but cannot find one. In the following sample, how do I animate the trasnformations (in the touch_began function) so that the drawing in the draw() function will move, scale and flip to my touch point ? Using layer.draw(), how do I go about doing this?
# coding: utf-8 from scene import * import ui class MyScene(Scene): def draw(self): startx = 20 starty = 20 length = 100 width = 200 #simple shape # begin location fill(.5,.5,.5) rect(startx, starty, width, length ) fill(0,1,0) rect(startx*2, starty, width/2, length/2) fill(1,0,0) ellipse(startx*2, starty*2, 10,10) ellipse(startx*8, starty*2, 10,10) def touch_began(self, touch): #end location print touch.location.x, touch.location.y push_matrix() scale(1.5, 1.5) translate(touch.location.x, touch.location.y) rotate(180) pop_matrix() class SceneViewer(ui.View): def __init__(self, in_scene): self.present('fullscreen') self.scene_view = SceneView(frame=self.bounds) self.scene_view.scene = in_scene self.add_subview(self.scene_view) SceneViewer(MyScene())
-
Animation of complex objects
I am just starting to experiment with scenes and I have a question. I have drawn a complex shape (e.g. a car) using lines, rects and ellipses on the scene. If I want to animate the whole shape with a sequence of rotate, scale, translate, how should I go able that? I tried layers, but it does not support drawings functions on the layer itself. Appreciate any pointers.
-
RE: textfield validation example
thanks for the replies, I think I understood it better now. One more question, how I keep the input focus to a field if it fails a validation, but still allow the user to cancel or click the X button to close the view?
-
RE: ui.webview and authentication
Thanks for the replies, both suggestions worked.
-
ui.webview and authentication
Is it possible to pass a username password to http Basic Auth in ui.webview? thx.
-
textfield validation example
reading through the doc, I understand that I can use delegate object to to implement the functions textField_did_change to implement validation. However, I cannot find any concrete example on this. I suppose I can test for the length!=0 and issur an alrt box, but do I need to raise any exception or call a built in to stop the processing when it failed such test? Any pointers?