Foundation HTML5 Animation with JavaScript
Copyright 2011 by Billy Lamberta
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-3665-8
ISBN-13 (electronic): 978-1-4302- 3666-5
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logos, or image we use the names, logos, or images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
Distributed to the book trade worldwide by Springer Science+Business Media LLC., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com
, or visit www.springeronline.com
.
For information on translations, please e-mail rights@apress.com
or visit www.apress.com
.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk SaleseBook Licensing web page at www.apress.com/bulk-sales
.
The information in this book is distributed on an as is basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work.
Credits
President and Publisher: Paul Manning | Coordinating Editor: Adam Heath |
Lead Editor: Ben Renow-Clarke | Copy Editor: Damon Larson |
Technical Reviewers: Robert Hawkes, Brian Danchilla | Compositor: Apress Production (Brigid Duffy) |
Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Morgan Engel, Jonathan Gennick, Jonathan Hassell, Robert Hutchinson, Michelle Lowman, James Markham, Matthew Moodie, Jeff Olson, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Gwenan Spearing, Matt Wade, Tom Welsh | Indexer: SPi Global Artist: SPi Global Cover Image Artist: Corn van Dooren Cover Designer: Anna Ishchenko |
For Jessica.
Billy Lamberta
Contents at a Glance
Contents
About the Author
Billy Lamberta is a programmer and multimedia experimenter. After working as a television news photojournalist in his hometown of Richmond, Virginia, he turned his attention to web development and interactive programming using Flash and JavaScript. Billy is interested in the convergence of visual mediums for the purpose of storytelling, and the promise of the open web for distribution. He lives in Buffalo, New York where he watches a lot of hockey.
About the Technical Reviewer
Brian Danchilla is a PHP and Java developer who has written web, numerical analysis, graphics and voip applications. Danchilla has a BA degree as a double major in computer science and mathematics and recently coauthored the book Pro PHP Programming (Apress 2011). When not programming, he likes to spend time playing guitar or being outside. He resides in Saskatoon, SK, Canada.
Robert Hawkes thrives on solving problems through code. He's addicted to visual programming, and can't get enough of HTML5 canvas. Most of his waking life is spent working on crazy projects involving all sorts of new and exciting technologies, both on-line and off. Aside from his practical work, Rob has written a book for Apress called Foundation HTML5 Canvas, which is all about making games with the new Web technology. He works as a Technical Evangelist for Mozilla.
About the Cover Image Artist
Corn van Dooren designed the front cover image for this book. After taking a brief hiatus from friends of ED to create a new design for the Foundation series, he worked at combining technological and organic forms, the results of which now appear on this and other book covers.
Corn spent his childhood drawing on everything at hand and then began exploring the infinite world of multimediaand his journey of discovery hasnt stopped since. His mantra has always been, The only limit to multimedia is the imaginationa saying that keeps him constantly moving forward.
Corn works for many international clients, writes features for multimedia magazines, reviews and tests software, authors multimedia studies, and works on many other friends of ED books. You can see more of his work at and contact him through his website at www.cornevandooren.com
.
Acknowledgments
This book owes a debt of gratitude to the people in the JavaScript and Flash communities who have contributed countless programs and tutorials for everyone to learn from. My programming knowledge is a direct result of the free-software movement, and the willingness of other programmers to share their code. Thank you for my education.
Thank you Keith Peters, who this book is just not possible without.
I've learned much from your work, and am honored to contribute, if just a little, to it.
Thanks to all the great people at Apress who worked very hard, and through my shortcomings, to put this book together. A special thank you to Ben Renow-Clarke and Adam Heath for their guidance, and to Brian Danchilla and Rob Hawkes for the fantastic feedback that made this book better.
Finally, thanks to my family: my parents who had the foresight to get a crazy and impractical home computer for us kids, even if I had to teach them how to turn it on; and to my sisters, who have always supported me. And, of course, thank you Jessica for being very patient with me during this entire process. I love you all.
Introduction
This book is about how to create interactive animations for the web using computer code and math. But don 't worry if you can't remember anything from your high school algebra class, you'll just need a minimal understanding to get started. The purpose of this book is to give you the tools to create and express your ideas, it's not about memorizing equations or theoryalthough I do explain the underlying ideasbut the practical application of techniques to incorporate in your work. These are concepts and formulas that you will see working, in real-time, right in front of you. Think of this book as the elements of motion, a catalog of ideas to mix, match, and reference.