I had a need for some animations for this thing I was doing (running a kind of a lottery on the big screen before the Star Wars movie tomorrow), and I used scripter again. I was happy how linear and easily readable it makes stuff, without extra animation functions or callbacks.

So, wanted to advertise it (again), in case there are new people, or people with new animation needs.

Part of what I needed to happen was:

  1. Marker is created, big as the screen
  2. It zooms to a specific spot and size
  3. It moves from point to point, stopping for a second at each
  4. It zooms out again to full screen, and simultaneously its:
  5. Round corners get squared
  6. Background darkens to black
  7. New content is presented
  8. After user taps it, it fades away

And here is the method, with yield marking the places where we wait for previous actions to complete:

@script
def run_lottery(self):
    spot = self.create_marker(self)
    self.add_subview(spot)
    width(spot, 15)
    height(spot, 20)
    pos = self.next_position()
    while pos:
        center(spot, pos)
        yield 1.0
        pos = self.next_position()
    frame(spot, self.bounds)
    corner_radius(spot, 0)
    background_color(spot, 'black')
    yield
    self.present_result(spot)
    wait_for_tap(spot)
    yield
    hide(spot)
    yield
    self.remove_subview(spot)

Since last version, I have added the wait_for_tap function, as well as convenience functions like background_color, corresponding to all animatable properties of the ui module views.