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
Instant Apple iBooks How-to

You're reading from   Instant Apple iBooks How-to Learn how to read and write books for iBookstore, by fully utilizing Apple iBooks and iBooks Author

Arrow left icon
Product type Paperback
Published in Feb 2013
Publisher Packt
ISBN-13 9781849694025
Length 52 pages
Edition 1st Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Zeeshan Chawdhary Zeeshan Chawdhary
Author Profile Icon Zeeshan Chawdhary
Zeeshan Chawdhary
Arrow right icon
View More author details
Toc

Adding HTML widgets and 3D models to your books (Become an expert)


There is more to an iBooks' book than text and images. With iBooks Author, you can add more interactivity to your books by adding HTML widgets and 3D models. Let's look at how iBooks Author helps us implement some of these exciting technologies in our books.

Getting ready

For our Attractions chapter we will add a few 3D models from Google Warehouse—http://sketchup.google.com/3dwarehouse/.

How to do it...

iBooks Author supports importing HTML5 widgets in the form of the .wdgt extension, which is basically a folder containing our HTML5 code, images, and an Info.plist file, which provides the iBooks app with information on how to run the HTML5 widget. We will create a simple Twitter widget that will pull information for the keyword "London" from Twitter.

  1. Create a folder and name it twitter-widget-ibooks, and within the folder create an index.html file using your favorite text editor. Using a simple Twitter Mashup from http://www.designchemical.com/blog/index.php/jquery/jquery-tutorial-create-a-jquery-twitter-feed-plugin/, we modify the code to search for the keyword "London".

  2. Here is how the HTML page should look now:

  3. Rename the twitter-widget-ibooks folder to twitter-widget-ibooks.wdgt; the folder icon should now look like a widget icon.

  4. Once the widget is ready, open iBooks Author and reload our London CityGuide book. Within the History section of the first chapter, insert an HTML widget using the Widgets button the toolbar, as shown in the following screenshot:

  5. Drag the HTML widget under the At a Glance section, and keeping the HTML widget selected, under the Interaction tab in Inspector, select the twitter-widget-ibooks.wdgt widget we created before:

  6. Previewing the book on your iPad shows the following results:

  7. To see the real-time tweets for London, click the Twitter icon, and you should see an overlay with real-time tweets for London. Clicking on the X icon on the overlay will bring you back to the book's page.

  8. Similarly, iBooks Author also supports importing 3D models as an interactive content within our books. Download a COLLADA (.dae file) model from http://sketchup.google.com/3dwarehouse/details?mid=e47ab8e194c03e5d5e73daf3c0b064fa.

  9. Extract the 3D model and import the same within our Attractions chapter, as shown in the following screenshot:

  10. Preview the book on your iPad to see the 3D model in action!

How it works...

The HTML5 widget is a collection of HTML, JavaScript, images, and an Info.plist file that notifies the iBooks app to render an HTML code.

Apple has added support for 3D objects in a completed book with up to 50,000 moderately-textured polygons for the second-generation iPad and iPads with a Retina display; for the first-gen iPad, this number is 20,000. The format supported right now is COLLADA—an interchangeable file format for 3D applications supported by most companies and 3D modeling software.

There's more...

Apple has put a good overview on how HTML widgets can be compiled, and specifications for the can be found at http://support.apple.com/kb/HT5068.

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