-
echen
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())
-
echen
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.
-
echen
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?
-
-
echen
Is it possible to pass a username password to http Basic Auth in ui.webview? thx.
-
echen
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?