Composing SKActions in Xcode
Story Tellers iOS Starter Kit 2 Documentation
Xcode 7 introduces the option to visually compose Actions on a timeline. You can do this in the SKScene for your page OR you can create a new Scene file specifically for Actions you’ll name and use later. Which is what you’re seeing in the image below. This is a file called YourActions.sks. Fortunately when using your action later, the file name is inconsequential. All you have to remember is the name of the Action (in this example, it is YourFirstAction). Which is what we would refer to it by in the Property List.
By clicking the + icon where the first green arrow is pointing, you’ll create and name your actions.
From there, you’ll simply drag and drop Actions into the timeline. You can change their duration, settings, etc from the Attributes editor on the right. You can even select multiple Actions and make them loop infinitely. Actions make it easy to compose a series of sounds, or sequence of animations all without writing code or setting properties in the kit’s Property List. All we have to do is tell the action to run, or stop. Most likely you’ll want to set up your Actions right on the page you’ll be designing (so you can preview them easily)
Where the Orange arrow is pointing below, you can toggle between Animate and Layout. In Layout mode you can move your nodes around the scene. In Animate mode the timeline will play and you can see the affect of your Actions.
Re-using your own SKActions!
The custom Actions you create can be reused. Every time you create an action, it will get added to the Object library. In the image below, the items with dotted square icons are all Actions I created to test things. So these Action references can be dropped back into the timeline and used elsewhere.
If you create a series of Actions in your scene on a specific node and think it is worth saving for later, select all the Actions, right click and choose Convert to Reference. Notice in the screen shot below, there are some other useful options like Cut, Copy, Delete, Duplicate, Reverse (cool!), and Create Loop.
SKActions for Animation
Your most frequented action when building an amazing book app will probably be the AnimateWithTextures Action.
Drag it into the timeline, set your duration, then add frames for the Elements animation sequence. To find the frames to add, you’ll need to switch from the Object Library tab to Media Library tab (where the second arrow is pointing).
You can set up an unlimited number of animations, ready for use later in the app by simply providing the name you chose.