Author
Travis Kirton


The end of a Movie

You can run some code when a movie reaches its end point. To do so, you set the movieEnded property like this:

movie.reachedEnd {
    //do stuff
}

Example

let movie = Movie("halo.mp4")!
movie.width = canvas.width
movie.center = canvas.center
canvas.add(movie)
movie.play()

movie.reachedEnd {
    let a = ViewAnimation(duration: 0.5) {
        movie.width = 50.0
        movie.center = self.canvas.center
    }
    a.autoreverses = true
    a.addCompletionObserver {
        movie.width = self.canvas.width
        movie.center = self.canvas.center
    }
    a.animate()
}