Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cocos2d Game Development Essentials

You're reading from   Cocos2d Game Development Essentials For new users - a quickstart guide to bringing your mobile game ideas to life with Cocos2D

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784390327
Length 136 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ben Trengrove Ben Trengrove
Author Profile Icon Ben Trengrove
Ben Trengrove
Arrow right icon
View More author details
Toc

Keyframe animation in SpriteBuilder

Animations can also be created in SpriteBuilder with keyframes. In the SpriteBuilder timeline, there is a full keyframe animation editor. Each node can have multiple properties animated.

Keyframe animation in SpriteBuilder

Keyframe animation works by setting a keyframe on the starting value and then later in the timeline, a keyframe is set for the ending value. The animation then automatically advances between these values.

It is easier to understand in practice:

  1. Open your main menu scene in SpriteBuilder. Drag out a Bird.ccb subfile. You will create an animation to move the bird from offscreen to the center of the screen.
  2. Drag the bird out of the scene to where it will start its animation.
    Keyframe animation in SpriteBuilder
  3. Now, you need to set a key frame for the starting position. Ensure your timeline is set to zero by dragging the blue bar in the timeline back to the start.
  4. With your bird node selected, open the menu and select Animation | Insert Keyframe | Position:
    Keyframe animation in SpriteBuilder

    This will add a keyframe to the timeline for position.

    Keyframe animation in SpriteBuilder
  5. Now...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image