Animate with Keynote & Swift Playgrounds

Animate with Keynote & Swift Playgrounds

This week I have been working with follow ADE and Author, Paul Hamilton to develop a workflow which will allow students in his Grade 6 class to understand and create their own animation using Keynote's new drawing features and Swift Playgrounds.

Below I have made the code available so that you can try creating an animation for yourself in Swift Playgrounds and the video to the right explains the workflow.

import UIKit
import PlaygroundSupport

class MyViewController: UIViewController{
    override func loadView() {
        let view = UIImageView()
        view.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
        
        let img1 = #imageLiteral(resourceName: "PNG image.png")
        let img2 = #imageLiteral(resourceName: "3__#$!@%!#__PNG image.png")
        let img3 = #imageLiteral(resourceName: "1__#$!@%!#__PNG image.png")
        let img4 = #imageLiteral(resourceName: "2__#$!@%!#__PNG image.png")
        
        let imageArray = [img1,img2,img3, img4]
        
        view.animationImages = imageArray
        view.animationDuration = 0.5
        view.animationRepeatCount = 10
        view.startAnimating()
        
        self.view = view
    }
}

PlaygroundPage.current.liveView = MyViewController()

Other Examples

Below are some examples of educators who have taken this template to create their own animations.  Please feel free to create your own and post it to twitter with the hashtags #EveryoneCanCode and #EveryoneCanCreate .

Exploring Functions through Music

Exploring Functions through Music

Update to mBot with Swift Playgrounds

Update to mBot with Swift Playgrounds