100% found this document useful (1 vote)
40 views53 pages

HTML5 Canvas 1st Edition Steve Fulton PDF Available

HTML5 Canvas 1st Edition by Steve Fulton and Jeff Fulton is a comprehensive guide to using the HTML5 Canvas for native interactivity and animation on the web. The book covers various topics including drawing, text, images, animation, and integrating audio and video. It is available in PDF format and was published by O'Reilly Media in 2011.

Uploaded by

mirelatoo5711
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
40 views53 pages

HTML5 Canvas 1st Edition Steve Fulton PDF Available

HTML5 Canvas 1st Edition by Steve Fulton and Jeff Fulton is a comprehensive guide to using the HTML5 Canvas for native interactivity and animation on the web. The book covers various topics including drawing, text, images, animation, and integrating audio and video. It is available in PDF format and was published by O'Reilly Media in 2011.

Uploaded by

mirelatoo5711
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

HTML5 Canvas 1st Edition Steve Fulton

Order directly from ebookfinal.com


( 4.6/5.0 ★ | 436 downloads )

https://ebookfinal.com/download/html5-canvas-1st-edition-steve-
fulton/
HTML5 Canvas 1st Edition Steve Fulton

EBOOK

Available Formats

■ PDF eBook Study Guide Ebook

EXCLUSIVE 2025 ACADEMIC EDITION – LIMITED RELEASE

Available Instantly Access Library


We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.

Canvas of Change 1st Edition Ilany Kogan

https://ebookfinal.com/download/canvas-of-change-1st-edition-ilany-
kogan/

Operating Model Canvas OMC 1st Edition Mark Lancelott

https://ebookfinal.com/download/operating-model-canvas-omc-1st-
edition-mark-lancelott/

HTML5 Solutions Essential Techniques for HTML5 Developers


1st Edition Marco Casario

https://ebookfinal.com/download/html5-solutions-essential-techniques-
for-html5-developers-1st-edition-marco-casario/

HTML5 Games Creating Fun with HTML5 CSS3 and WebGL 1st
Edition Jacob Seidelin

https://ebookfinal.com/download/html5-games-creating-fun-with-
html5-css3-and-webgl-1st-edition-jacob-seidelin/
HTML5 Hacks 1st Edition Jesse Cravens

https://ebookfinal.com/download/html5-hacks-1st-edition-jesse-cravens/

HTML5 Games 2nd Edition Creating Fun with HTML5 CSS3 and
WebGL Jacob Seidelin

https://ebookfinal.com/download/html5-games-2nd-edition-creating-fun-
with-html5-css3-and-webgl-jacob-seidelin/

Mobile HTML5 First Edition Weyl

https://ebookfinal.com/download/mobile-html5-first-edition-weyl/

Practical HTML5 Projects 1st Edition Adrian W. West

https://ebookfinal.com/download/practical-html5-projects-1st-edition-
adrian-w-west/

HTML5 Geolocation 1st Edition Anthony T. Holdener Iii

https://ebookfinal.com/download/html5-geolocation-1st-edition-anthony-
t-holdener-iii/
HTML5 Canvas 1st Edition Steve Fulton Digital Instant
Download
Author(s): Steve Fulton, Jeff Fulton
ISBN(s): 9781449393908, 144939390X
Edition: 1
File Details: PDF, 15.07 MB
Year: 2011
Language: english
HTML5 Canvas
HTML5 Canvas
Native Interactivity and Animation for the Web

Steve Fulton and Jeff Fulton

Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo


HTML5 Canvas
by Steve Fulton and Jeff Fulton

Copyright © 2011 8bitrocket Studios. All rights reserved.


Printed in the United States of America.

Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.

O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or [email protected].

Editors: Mike Loukides and Simon St.Laurent Indexer: Ellen Troutman Zaig
Production Editor: Kristen Borg Cover Designer: Karen Montgomery
Copyeditor: Marlowe Shaeffer Interior Designer: David Futato
Proofreader: Sada Preisch Illustrator: Robert Romano

Printing History:
May 2011: First Edition.

Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. HTML5 Canvas, the image of a kaka parrot, and related trade dress are trademarks
of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.

While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.

ISBN: 978-1-449-39390-8

[LSI]

1303735727
To Flash.
Table of Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

1. Introduction to HTML5 Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


The Basic HTML Page 2
<!doctype html> 3
<html lang="en"> 3
<meta charset="UTF-8"> 3
<title>…</title> 3
A Simple HTML5 Page 3
Basic HTML We Will Use in This Book 4
<div> 4
<canvas> 5
The Document Object Model (DOM) and Canvas 5
JavaScript and Canvas 6
JavaScript Frameworks and Libraries 6
Where Does JavaScript Go and Why? 6
HTML5 Canvas “Hello World!” 7
Encapsulating Your JavaScript Code for Canvas 8
Adding Canvas to the HTML Page 9
Testing to See Whether the Browser Supports Canvas 10
Retrieving the 2D Context 11
The drawScreen() Function 11
Debugging with Console.log 14
The 2D Context and the Current State 15
The HTML5 Canvas Object 16
Another Example: Guess The Letter 17
How the Game Works 17
The “Guess The Letter” Game Variables 17
The initGame() Function 19
The eventKeyPressed() Function 19
The drawScreen() Function 21
Exporting Canvas to an Image 22

vii
The Final Game Code 23
What’s Next 26

2. Drawing on the Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27


The Basic File Setup for This Chapter 27
The Basic Rectangle Shape 28
The Canvas State 29
What’s Not Part of the State? 30
How Do We Save and Restore the Canvas State? 30
Using Paths to Create Lines 30
Starting and Ending a Path 31
The Actual Drawing 31
Examples of More Advanced Line Drawing 32
Advanced Path Methods 34
Arcs 34
Bezier Curves 36
The Canvas Clipping Region 37
Compositing on the Canvas 39
Simple Canvas Transformations 41
Rotation and Translation Transformations 42
Scale Transformations 47
Combining Scale and Rotation Transformations 49
Filling Objects with Colors and Gradients 51
Setting Basic Fill Colors 51
Filling Shapes with Gradients 52
Filling Shapes with Patterns 61
Creating Shadows on Canvas Shapes 64
What’s Next 67

3. The HTML5 Canvas Text API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69


Displaying Basic Text 69
Basic Text Display 69
Handling Basic Text in Text Arranger 70
Communicating Between HTML Forms and the Canvas 71
Using measureText 71
fillText and strokeText 73
Setting the Text Font 78
Font Size, Face Weight, and Style Basics 78
Handling Font Size and Face in Text Arranger 79
Font Color 83
Font Baseline and Alignment 86
Text Arranger Version 2.0 90
Text and the Canvas Context 94

viii | Table of Contents


Global Alpha and Text 94
Global Shadows and Text 96
Text with Gradients and Patterns 100
Linear Gradients and Text 100
Radial Gradients and Text 102
Image Patterns and Text 102
Handling Gradients and Patterns in Text Arranger 103
Width, Height, Scale, and toDataURL() Revisited 106
Dynamically Resizing the Canvas 106
Dynamically Scaling the Canvas 109
The toDataURL() Method of the Canvas Object 110
Final Version of Text Arranger 112
What’s Next 121

4. Images on the Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123


The Basic File Setup for This Chapter 123
Image Basics 124
Preloading Images 125
Displaying an Image on the Canvas with drawImage() 125
Resizing an Image Painted to the Canvas 127
Copying Part of an Image to the Canvas 128
Simple Cell-Based Sprite Animation 130
Creating an Animation Frame Counter 130
Creating a Timer Loop 131
Changing the Tile to Display 131
Advanced Cell-Based Animation 132
Examining the Tile Sheet 133
Creating an Animation Array 133
Choosing the Tile to Display 133
Looping Through the Tiles 134
Drawing the Tile 134
Moving the Image Across the Canvas 135
Applying Rotation Transformations to an Image 137
Canvas Transformation Basics 137
Animating a Transformed Image 140
Creating a Grid of Tiles 142
Defining a Tile Map 143
Creating a Tile Map with Tiled 143
Displaying the Map on the Canvas 145
Zooming and Panning an Image 149
Creating a Window for the Image 149
Drawing the Image Window 150
Panning the Image 152

Table of Contents | ix
Zoom and Pan the Image 153
Application: Controlled Pan and Zoom 154
Pixel Manipulation 158
The Canvas Pixel Manipulation API 158
Application Tile Stamper 159
Copying from One Canvas to Another 166
What’s Next 169

5. Math, Physics, and Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171


Moving in a Straight Line 171
Moving Between Two Points: The Distance of a Line 174
Moving on a Vector 179
Bouncing Off Walls 183
Bouncing a Single Ball 184
Multiple Balls Bouncing Off Walls 188
Multiple Balls Bouncing with a Dynamically Resized Canvas 193
Multiple Balls Bouncing and Colliding 198
Multiple Balls Bouncing with Friction 210
Curve and Circular Movement 216
Uniform Circular Motion 217
Moving in a Simple Spiral 220
Cubic Bezier Curve Movement 223
Moving an Image 228
Creating a Cubic Bezier Curve Loop 232
Simple Gravity, Elasticity, and Friction 236
Simple Gravity 236
Simple Gravity with a Bounce 240
Gravity with Bounce and Applied Simple Elasticity 243
Simple Gravity, Simple Elasticity, and Simple Friction 246
Easing 249
Easing Out (Landing the Ship) 249
Easing In (Taking Off) 253
What’s Next? 257

6. Mixing HTML5 Video and Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259


HTML5 Video Support 259
Theora + Vorbis = .ogg 260
H.264 + $$$ = .mp4 260
VP8 + Vorbis = .webm 260
Combining All Three 261
Converting Video Formats 261
Basic HTML5 Video Implementation 262
Plain-Vanilla Video Embed 263

x | Table of Contents
Video with Controls, Loop, and Autoplay 265
Altering the Width and Height of the Video 266
Preloading Video in JavaScript 271
A Problem with Events and Embedded Video in HTML5 274
Video and the Canvas 275
Displaying a Video on HTML5 Canvas 275
HTML5 Video Properties 281
Video on the Canvas Examples 285
Using the currentTime Property to Create Video Events 285
Canvas Video Transformations: Rotation 289
Canvas Video Puzzle 294
Creating Video Controls on the Canvas 307
Animation Revisited: Moving Videos 316
What’s Next? 320

7. Working with Audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321


The Basic <audio> Tag 321
Audio Formats 322
Supported Formats 322
Audacity 322
Example: Using All Three Formats 323
Audio Tag Properties, Functions, and Events 324
Audio Functions 325
Important Audio Properties 325
Important Audio Events 326
Loading and Playing the Audio 326
Displaying Attributes on the Canvas 327
Playing a Sound with No Audio Tag 331
Dynamically Creating an Audio Element in JavaScript 331
Finding the Supported Audio Format 332
Playing the Sound 333
Look Ma, No Tag! 334
Creating a Canvas Audio Player 336
Creating Custom User Controls on the Canvas 337
Loading the Button Assets 337
Setting Up the Audio Player Values 339
Mouse Events 340
Sliding Play Indicator 340
Play/Pause Push Button: Hit Test Point Revisited 342
Loop/No Loop Toggle Button 343
Click-and-Drag Volume Slider 344
Case Study in Audio: Space Raiders Game 352
Why Sounds in Apps Are Different: Event Sounds 353

Table of Contents | xi
Iterations 353
Space Raiders Game Structure 353
Iteration #1: Playing Sounds Using a Single Object 362
Iteration #2: Creating Unlimited Dynamic Sound Objects 362
Iteration #3: Creating a Sound Pool 365
Iteration #4: Reusing Preloaded Sounds 368
What’s Next 378

8. Canvas Game Essentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379


Why Games in HTML5? 379
Canvas Compared to Flash 379
What Does Canvas Offer? 380
Our Basic Game HTML5 File 380
Our Game’s Design 382
Game Graphics: Drawing with Paths 382
Needed Assets 382
Using Paths to Draw the Game’s Main Character 383
Animating on the Canvas 385
Game Timer Loop 385
The Player Ship State Changes 386
Applying Transformations to Game Graphics 388
The Canvas Stack 388
Game Graphic Transformations 390
Rotating the Player Ship from the Center 390
Alpha Fading the Player Ship 392
Game Object Physics and Animation 393
How Our Player Ship Will Move 393
Controlling the Player Ship with the Keyboard 395
Giving the Player Ship a Maximum Velocity 399
A Basic Game Framework 400
The Game State Machine 400
The Update/Render (Repeat) Cycle 404
The FrameRateCounter Object Prototype 406
Putting It All Together 407
Geo Blaster Game Structure 407
Geo Blaster Global Game Variables 410
The player Object 412
Geo Blaster Game Algorithms 412
Arrays of Logical Display Objects 412
Level Knobs 415
Level and Game End 415
Awarding the Player Extra Ships 416
Applying Collision Detection 417

xii | Table of Contents


The Geo Blaster Basic Full Source 419
Rock Object Prototype 443
What’s Next 445

9. Combining Bitmaps and Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447


Geo Blaster Extended 447
Geo Blaster Tile Sheet 448
Rendering the Other Game Objects 454
Adding Sound 459
Pooling Object Instances 463
Adding in a Step Timer 466
Geo Blaster Extended Full Source 468
Creating a Dynamic Tile Sheet at Runtime 497
A Simple Tile-Based Game 501
Micro Tank Maze Description 501
The Tile Sheet for Our Game 503
The Playfield 504
The Player 505
The Enemy 506
The Goal 507
The Explosions 507
Turn-Based Game Flow and the State Machine 508
Simple Tile Movement Logic Overview 512
Rendering Logic Overview 514
Simple Homegrown AI Overview 515
Micro Tank Maze Complete Game Code 516
What’s Next 534

10. Mobilizing Games with PhoneGap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535


Going Mobile! 535
Introducing PhoneGap 536
The Application 536
The Code 537
Examining the Code for BSBingo.html 542
The Application Code 545
Creating the iOS Application with PhoneGap 546
Installing Xcode 546
Installing PhoneGap 547
Creating the BS Bingo PhoneGap Project in Xcode 549
Testing the New Blank Application in the Simulator 551
Integrating BS Bingo into the Project 553
Setting the Orientation 555
Changing the Banner and Icon 556

Table of Contents | xiii


Testing on the Simulator 558
Adding in an iPhone “Gesture” 561
Adding the Gesture Functions to index.html 561
Testing on a Device 563
Using Xcode to Target a Test Device 564
Beyond the Canvas 565
What’s Next 566

11. Further Explorations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567


3D with WebGL 567
What Is WebGL? 568
How Do I Test WebGL? 568
How Do I Learn More About WebGL? 569
What Does a WebGL Application Look Like? 569
Full Code Listing 575
Further Explorations with WebGL 581
WebGL JavaScript Libraries 581
Multiplayer Applications with ElectroServer 5 583
Installing ElectroServer 583
The Basic Architecture of a Socket-Server Application 585
The Basic Architecture of an ElectroServer Application 587
Creating a Chat Application with ElectroServer 588
Testing the Application in Google Chrome 593
Further Explorations with ElectroServer 598
This Is Just the Tip of the Iceberg 606
Conclusion 607

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609

xiv | Table of Contents


Preface

HTML5 Canvas offers developers the chance to create animated graphics in ordinary
web browsers using common tools: HTML and JavaScript. Canvas is one of the most
visible parts of HTML5, fueling demo after demo, game after game. It offers interactivity
with great visuals, and provides tremendous freedom to do whatever you want in the
browser window. However, it differs enough from typical JavaScript development (as
well as Flash and Silverlight development) that it needs careful exploration!

Running the Examples in the Book


The best part about programming HTML5 Canvas is that the entry barrier is very low—
all you need is a modern web browser and a text editor.
As far as compatibility, we suggest you download and/or use the latest version of the
web browsers as ordered below.
1. Chrome
2. Safari
3. Opera
4. Firefox
5. Internet Explorer (version 9 or higher)
Every example in this book was tested with Google Chrome, Safari, and Opera. Late
in the development of the example code, Firefox started causing issues. While we made
every attempt to ensure these examples worked across as many browsers as possible,
we recommend you use Google Chrome or Safari for the best results until Canvas
support improves.
Please note that if you are using the .pdf version of this book to cut and paste the code,
there may be instances where minus (“-”) signs are represented by another character,
such as a hyphen. You may need to replace the other character with a minus sign (“-”)
to get the code to work properly.

xv
We suggest that if you have purchased the electronic version of this book, you should
use the printed code samples as a guide only, and instead download the code from the
book distribution. With that code, you will also get all the images, libraries, and assets
necessary to make all the examples work in a web browser.

What You Need to Know


Ideally, you know your way around programming in some kind of modern language,
such as C, C++, C#, ActionScript 2, ActionScript 3, Java, or JavaScript. However, if
you’re new to this space, we will introduce Canvas in a way that should familiarize you
with web programming at the same time.
Web developers with a foundation in HTML and JavaScript should easily be able to
pick up this book and run with it.
If you are a Flash developer, JavaScript and ActionScript 1 are essentially the same
language. While Adobe took some liberties with ActionScript 2, you should be very
comfortable with JavaScript. If you only have experience with ActionScript 3, Java-
Script might feel like a step backward.
If you are a Silverlight or C# developer, take a deep breath and think about a time
before ASP.NET/C# when you might have had to develop web apps in VBScript. You
are about to enter a similar space.

How This Book Is Organized


This book is organized into 11 chapters. The first four chapters walk you through the
HTML Canvas API by example. The topics covered include text, images, and drawing.
These chapters contain a few finished apps, but mainly consist of demos designed to
show you the facets of the Canvas API. The following six chapters build upon the
Canvas API by expanding the scope of the examples to application length. In these
chapters, we discuss math and physics applications, video, audio, games, and mobile.
The final chapter introduces a couple experimental areas: 3D and multiplayer.
What you won’t get in this book is a simple rundown and retelling of the published
W3C Canvas API. While we cover portions of the API in detail, some of it is not ap-
plicable to games. Furthermore, you can just read the documentation here:
http://dev.w3.org/html5/2dcontext
Our goal is to feature the ways Canvas can be used to create animation, games, and
entertainment applications for the Web.

xvi | Preface
Conventions Used in This Book
The following typographical conventions are used in this book:
Plain text
Indicates menu titles, menu options, menu buttons, and keyboard accelerators
(such as Alt and Ctrl).
Italic
Indicates new terms, URLs, email addresses, filenames, file extensions, pathnames,
directories, and Unix utilities.
Constant width
Indicates commands, options, switches, variables, attributes, keys, functions,
types, classes, namespaces, methods, modules, properties, parameters, values, ob-
jects, events, event handlers, XML tags, HTML tags, macros, the contents of files,
or the output from commands.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values.

This icon signifies a tip, suggestion, or general note.

This icon indicates a warning or caution.

Using Code Examples


This book is here to help you get your job done. In general, you may use the code in
this book in your programs and documentation. You do not need to contact us for
permission unless you’re reproducing a significant portion of the code. For example,
writing a program that uses several chunks of code from this book does not require
permission. Selling or distributing a CD-ROM of examples from O’Reilly books does
require permission. Answering a question by citing this book and quoting example
code does not require permission. Incorporating a significant amount of example code
from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title,
author, publisher, and ISBN. For example: “HTML5 Canvas by Steve Fulton and Jeff
Fulton (O’Reilly). Copyright 2011 8bitrocket Studios, 978-1-4493-9390-8.”

Preface | xvii
If you feel your use of code examples falls outside fair use or the permission given above,
feel free to contact us at [email protected].

We’d Like to Hear from You


Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
(800) 998-9938 (in the United States or Canada)
(707) 829-0515 (international or local)
(707) 829-0104 (fax)
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at:
http://www.oreilly.com/catalog/9781449393908
To comment or ask technical questions about this book, send email to:
[email protected]
For more information about our books, courses, conferences, and news, see our website
at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia

Safari® Books Online


Safari Books Online is an on-demand digital library that lets you easily
search over 7,500 technology and creative reference books and videos to
find the answers you need quickly.
With a subscription, you can read any page and watch any video from our library online.
Read books on your cell phone and mobile devices. Access new titles before they are
available for print, and get exclusive access to manuscripts in development and post
feedback for the authors. Copy and paste code samples, organize your favorites, down-
load chapters, bookmark key sections, create notes, print out pages, and benefit from
tons of other time-saving features.
O’Reilly Media has uploaded this book to the Safari Books Online service. To have full
digital access to this book and others on similar topics from O’Reilly and other pub-
lishers, sign up for free at http://my.safaribooksonline.com.

xviii | Preface
Acknowledgments
First, Steve would like to thank his beautiful wife, Dawn, for the amazing patience,
guidance, and support she lovingly provided before, during, and after this book was
written. Steve would also like to thank his girls—Rachel, Daphnie, and Katie—for all
their enthusiastic support and for not getting too frustrated every time they asked him
to play and Daddy said, “Sure, yeah, in just a couple minutes” because his head was
buried in these pages. He’d also like to thank his mom and dad, plus his sisters, Mari
and Carol for everything they taught us; and his uncle Richard and cousin John for all
their love and support. Also thanks to Sue, Morgan, and Lauren Miller; Jen, Eric, Sarah,
and Paige Garnica; Dietrich; Chantal Martin; and Ryan and Justin Fulton.
Jeff would like to thank his amazing wife, Jeanne, and his two wonderful boys, Ryan
and Justin, for putting up with him writing this second book in two years. The writing
process is a time- and energy-consuming endeavor that demands patience and under-
standing from those in close proximity to the temperamental author. Jeff would also
like to thank his mom and dad, as well as sisters Mari and Carol, for the morale and
babysitting support that was needed during the crucial writing times. Also, special
thanks to the Perry and Backlar clans for all of their love and support.
The authors would also like to acknowledge all the fine people at O’Reilly, especially
Mike Loukides, who took the chance on us for this book; and Simon St.Laurent, who
led us out of the wilderness; our copyeditor, Marlowe Shaeffer, who made the text
sparkle in her own special way; and our production editor, Kristen Borg, for finishing
the job.
We’d also like to thank our technical reviewers, Raffaele Cecco, Shelley Powers, and
Andres Pagella.
Thanks to everyone at Electrotank, especially Jobe Makar, Matthew Weisner, and
Teresa Carrigan; as well as our friends at Jett Morgan, Creative Bottle, Producto Stu-
dios, Mattel, Mochi, Adobe, Microsoft, Zynga, The SPIL Group, Giles Thomas from
Learningwebgl.com, Ari Feldman, and Terry Paton, plus Ace The Super Villain, Bas
Alicante, egdcltd, Tony Fernando, SeuJogo, Hayes, Jose Garay, Richard Davey
(@PhotonStorm), Squize and nGfx (@GamingYourWay), and all our other friends at
8bitrocket.com. We would also like to give a huge shout out to the simply outstanding
team at 444 Deharo, especially the entire FV team and the Foo Fighters pod!
Finally, we'd like to thank all of our friends who helped along the way, including Ian
Legler, Brandon Crist, Eric Barth, Wesley Crews, Kenny Brown, Mike Foti, Evan
Pershing, Scott Johnson, Scott Lunceford, Kurt Legler, Ryan Legler, John Little, Matt
Hyatt, Varun Tandon, Mark Hall, Jason Neifeld, Mike Peters and The Alarm.
…and, last but not least, thanks to the W3C for coming up with such a kickass spec for
HTML5 Canvas.

Preface | xix
Another Random Scribd Document
with Unrelated Content
and to pass my time in cross-examining each as to his true or false
knowledge!101 Lastly, so far as he professes to aim at any positive
end, it is the diffusion of political, social, human virtue, as
distinguished from acquisitions above the measure of humanity. He
tells men that it is not wealth which produces virtue, but virtue which
produces wealth and other advantages, both public and private.102

98 Plato, Apol. Sokr. pp. 21-29. καὶ τοῦτο πῶς οὐκ ἀμαθία ἐστὶν
αὕτη ἡ ἐπονείδιστος, ἡ τοῦ οἴεσθαι εἰδέναι ἃ οὐκ οἶδεν; (29 A-B).

99 Plato, Apol. Sokr. pp. 21-23, 31 D; 33 C: ἐμοὶ δὲ τοῦτο, ὡς ἐγώ


φημι, προστέτακται ὑπὸ τοῦ θεοῦ πράττειν καὶ ἐκ μαντειῶν καὶ ἐξ
ἐνυπνίων καὶ παντὶ τρόπῳ, ᾧπέρ τίς ποτε καὶ ἄλλη θεία μοῖρα
ἀνθρώπῳ καὶ ὁτιοῦν προσέταξε πράττειν. p. 37 E: ἐάν τε γὰρ λέγω
ὅτι τῷ θεῷ ἀπειθεῖν τοῦτ’ ἐστὶ καὶ διὰ τοῦτ’ ἀδύνατον ἡσυχίαν ἄγειν,
οὐ πείσεσθέ μοι ὡς εἰρωνευομένῳ.

100 Plato, Apol. S. p. 29 B.

In the Xenophontic Apology of Sokrates, no allusion is made to the


immortality of the soul. Sokrates is there described as having shaped
his defence under a belief that he had arrived at a term when it was
better for him to die than to live, and that prolonged life would only
expose him to the unavoidable weaknesses and disabilities of senility.
It is a proof of the benevolence of the Gods that he is withdrawn
from life at so opportune a moment. This is the explanation which
Xenophon gives of the haughty tone of the defence (sects. 6-15-23-
27). In the Xenophontic Cyropædia, Cyrus, on his death-bed,
addresses earnest exhortations to his two sons: and to give greater
force to such exhortations, reminds them that his own soul will still
survive and will still exercise a certain authority after his death. He
expresses his own belief not only that the soul survives the body, but
also that it becomes more rational when disembodied; because — 1.
Murderers are disturbed by the souls of murdered men. 2. Honours
are paid to deceased persons, which practice would not continue,
unless the souls of the deceased had efficacy to enforce it. 3. The
souls of living men are more rational during sleep than when awake,
and sleep affords the nearest analogy to death (viii. 7, 17-21). (Much
the same arguments were urged in the dialogues of Aristotle.
Bernays, Dialog. Aristot. pp. 23-105.) He however adds, that even if
he be mistaken in this point, and if his soul perish with his body, still
he conjures his sons, in the name of the gods, to obey his dying
injunctions (s. 22). Again, he says (s. 27), “Invite all the Persians to
my tomb, to join with me in satisfaction that I shall now be in safety,
so as to suffer no farther harm, whether I am united to the divine
element, or perish altogether” (συνησθησομένους ἐμοί, ὅτι ἐν τῷ
ἀσφαλεῖ ἤδη ἔσομαι, ὡς μηδὲν ἂν ἔτι κακὸν παθεῖν, μήτε ἢν μετὰ τοῦ
θείου γένωμαι, μήτε ἢν μηδὲν ἔτι ᾦ). The view taken here by Cyrus,
of death in its analogy with sleep (ὕπνῳ καὶ θανάτῳ διδυμάοσιν,
Iliad, xvi. 672) as a refuge against impending evil for the future, is
much the same as that taken by Sokrates in his Apology. Sokrates is
not less proud of his past life, spent in dialectic debate, than Cyrus of
his glorious exploits. Ὁ θάνατος, λιμὴν κακῶν τοῖς δυσδαιμονοῦσιν,
Longinus, de Subl. c. 9, p. 23. Compare also the Oration of Julius
Cæsar in Sallust, Bell. Catilin. c. 51 — “in luctu atque miseriis,
mortem ærumnarum requiem, non cruciatum esse: illam cuncta
mortalium mala dissolvere: ultra neque curæ neque gaudio locum
esse“.

101 Plato, Apol. S. pp. 40-41.

102 Plato, Apol. S. pp. 20 C, 29-30. λέγων ὅτι οὐκ ἐκ χρημάτων


ἀρετὴ γίγνεται, ἀλλ’ ἐξ ἀρετῆς χρήματα, καὶ τἆλλα ἀγαθὰ τοῖς
ἀνθρώποις ἅπαντα, καὶ ἰδίᾳ καὶ δημοσίᾳ (30 B). Compare Xenophon,
Memorab. i. 2, 8-9.

If from the Apology we turn to the


Abundant dogmatic and
Phædon, we seem to pass, not merely
poetical invention of the
to the same speaker after the interval
Phædon compared with the
of one month (the ostensible interval
profession of ignorance
indicated) but to a different speaker
which we read in the
and over a long period. We have Plato
Apology.
speaking through the mouth of
Sokrates, and Plato too at a much later time.103 Though the moral
character (ἦθος) of Sokrates is fully maintained and even strikingly
dramatised — the intellectual personality is altogether transformed.
Instead of a speaker who avows his own ignorance, and blames
others only for believing themselves to know when they are equally
ignorant — we have one who indulges in the widest range of theory
and the boldest employment of hypothesis. Plato introduces his own
dogmatical and mystical views, leaning in part on the Orphic and
Pythagorean creeds.104 He declares the distinctness of nature, the
incompatibility, the forced temporary union and active conflict,
between the soul and the body. He includes this in the still wider and
more general declaration, which recognises antithesis between the
two worlds: the world of Ideas, Forms, Essences, not perceivable but
only cogitable, eternal, and unchangeable, with which the soul or
mind was in kindred and communion — the world of sense, or of
transient and ever-changing appearances or phenomena, never
arriving at permanent existence, but always coming and going, with
which the body was in commerce and harmony. The philosopher, who
thirsts only after knowledge and desires to look at things105 as they
are in themselves, with his mind by itself — is represented as
desiring, throughout all his life, to loosen as much as possible the
implication of his soul with his body, and as rejoicing when the hour
of death arrives to divorce them altogether.

103 In reviewing the Apology (supra, vol. i. ch. ix. p. 410) I have
already noticed this very material discrepancy, which is insisted upon
by Ast as an argument for disallowing the genuineness of the
Apology.

104 Plato, Phædon, pp. 69 C, 70 C, 81 C, 62 B.

105 Plato, Phædon, p. 66 E. ἀπαλλακτέον αὐτοῦ (τοῦ σώματος) καὶ


αὐτῇ τῇ ψυχῇ θεατέον αὐτὰ τὰ πράγματα.

Such total renunciation of the body is


Total renunciation and
put, with dramatic propriety, into the
discredit of the body in the
mouth of Sokrates during the last hour
Phædon. Different feeling
of his life. But it would not have been in
about the body in other
harmony with the character of Sokrates
Platonic dialogues.
as other Platonic dialogues present him
— in the plenitude of life — manifesting distinguished bodily strength
and soldierly efficiency, proclaiming gymnastic training for the body
to be co-ordinate with musical training for the mind, and impressed
with the most intense admiration for the personal beauty of youth.
The human body, which in the Phædon is discredited as a morbid
incumbrance corrupting the purity of the soul, is presented to us by
Sokrates in the Phædrus as the only sensible object which serves as
a mirror and reflection of the beauty of the ideal world:106 while the
Platonic Timæus proclaims (in language not unsuitable to Locke) that
sight, hearing, and speech are the sources of our abstract Ideas, and
the generating causes of speculative intellect and philosophy.107 Of
these, and of the world of sense generally, an opposite view was
appropriate in the Phædon; where the purpose of Sokrates is to
console his distressed friends by showing that death was no
misfortune, but relief from a burthen. And Plato has availed himself
of this impressive situation,108 to recommend, with every charm of
poetical expression, various characteristic dogmas respecting the
essential distinction between Ideas and the intelligible world on one
side — Perceptions and the sensible world on the other: respecting
the soul, its nature akin to the intelligible world, its pre-existence
anterior to its present body, and its continued existence after the
death of the latter: respecting the condition of the soul before birth
and after death, its transition, in the case of most men, into other
bodies, either human or animal, with the condition of suffering
penalties commensurate to the wrongs committed in this life: finally,
respecting the privilege accorded to the souls of such as have passed
their lives in intellectual and philosophical occupation, that they shall
after death remain for ever disembodied, in direct communion with
the world of Ideas.

106 Plato, Charmidês, p. 155 D. Protagoras, init. Phædrus, p. 250 D.


Symposion, pp. 177 C, 210 A.

Æschines, one of the Socratici viri or fellow disciples of Sokrates


along with Plato, composed dialogues (of the same general nature as
those of Plato) wherein Sokrates was introduced conversing or
arguing. Æschines placed in the mouth of Sokrates the most intense
expressions of passionate admiration towards the person of
Alkibiades. See the Fragments cited by the Rhetor Aristeides, Orat.
xlv. pp. 20-23, ed. Dindorf. Aristeides mentions (p. 24) that various
persons in his time mistook these expressions ascribed to Sokrates
for the real talk of Sokrates himself. Compare also the Symposion of
Xenophon, iv. 27.
107 Plato, Timæus, p. 47, A-D. Consult also the same dialogue, pp.
87-88, where Plato insists on the necessity of co-ordinate attention
both to mind and to body, and on the mischiefs of highly developed
force in the mind unless it be accompanied by a corresponding
development of force in the body.

108 Compare the description of the last discourse of Pætus Thrasea.


Tacitus, Annal. xvi. 34.

The main part of Plato’s


Plato’s argument does not
argumentation, drawn from the general
prove the immortality of
assumptions of his philosophy, is
the soul. Even if it did
directed to prove the separate and
prove that, yet the mode of
perpetual existence of the soul, before
pre-existence and the
as well as after the body. These
mode of post-existence, of
arguments, interesting as specimens of
the soul, would be quite
the reasoning which satisfied Plato, do
undetermined.
not prove his conclusion.109 But even if
that conclusion were admitted to be proved, the condition of the
soul, during such anterior and posterior existence, would be
altogether undetermined, and would be left to the free play of
sentiment and imagination. There is no subject upon which the
poetical genius of Plato has been more abundantly exercised.110 He
has given us two different descriptions of the state of the soul before
its junction with the body (Timæus, and Phædrus), and three
different descriptions of its destiny after separation from the body
(Republic, Gorgias, Phædon). In all the three, he supposes an
adjudication and classification of the departed souls, and a better or
worse fate allotted to each according to the estimate which he forms
of their merits or demerits during life: but in each of the three, this
general idea is carried out by a different machinery. The Hades of
Plato is not announced even by himself as anything more than
approximation to the truth: but it embodies his own ethical and
judicial sentence on the classes of men around him — as the Divina
Commedia embodies that of Dante on antecedent individual persons.
Plato distributes rewards and penalties in the measure which he
conceives to be deserved: he erects his own approbation and
disapprobation, his own sympathy and antipathy, into laws of the
unknown future state: the Gods, whom he postulates, are imaginary
agents introduced to execute the sentences which he dictates. While
others, in their conceptions of posthumous existence, assured the
happiest fate, sometimes even divinity itself, to great warriors and
law-givers — to devoted friends and patriots like Harmodius and
Aristogeiton — to the exquisite beauty of Helen — or to favourites of
the Gods like Ganymêdes or Pelops111 — Plato claims that supreme
distinction for the departed philosopher.

109 Wyttenbach has annexed to his edition of the Phædon an


instructive review of the argumentation contained in it respecting the
Immortality of the soul. He observes justly — “Videamus jam de
Phædone, qui ab omni antiquitate is habitus est liber, in quo rationes
immortalitatis animarum gravissimé luculentissiméque exposita
essent. Quæ quidem libro laus et auctoritas conciliata est, non tam
firmitate argumentorum, quam eloquentiâ Platonis,” &c. (Disputat.
De Placit. Immort. Anim. p. 10). The same feeling, substantially, is
expressed by one of the disputants in Cicero’s Tusculan Disputations,
who states that he assented to the reasoning while he was reading
the dialogue, but that as soon as he had laid down the book, his
assent all slipped away from him. I have already mentioned that
Panætius, an extreme admirer of Plato on most points, dissented
from him about the immortality of the soul (Cicero, Tusc. Disp. i. 11,
24 — i. 32, 79), and declared the Phædon to be spurious. Galen also
mentions (De Format. Fœtûs, vol. iv. pp. 700-702. Kühn) that he had
written a special treatise (now lost) to prove that the reasonings in
the Phædon were self-contradictory, and that he could not satisfy
himself, either about the essence of the soul, or whether it was
mortal or immortal. Compare his treatise Περὶ Οὐσίας τῶν φυσικῶν
δυνάμεων — iv. pp. 762-763 — and Περὶ τῶν τῆς ψυχῆς ἠθῶν, iv.
773. In this last passage, he represents the opinion of Plato to be —
That the two inferior souls, the courageous and the appetitive, are
mortal, in which he (Galen) agrees, and that the rational soul alone is
immortal, of which he (Galen) is not persuaded. Now this view of
Plato’s opinion is derived from the Republic and Timæus, not from
the Phædon, in which last the triple soul is not acknowledged. We
may thus partly understand the inconsistencies, which Galen pointed
out in his lost Treatise, in the argumentation of the Phædon: wherein
one of the proofs presented to establish the immortality of the soul is
— That the soul is inseparably and essentially identified with life, and
cannot admit death (p. 105 D). This argument, if good at all, is just
as good to prove the immortality of the two inferior souls, as of the
superior and rational soul. Galen might therefore remark that it did
not consist with the conclusion which he drew from the Timæus and
the Republic.

110 Wyttenbach, l. c. p. 19. “Vidimus de philosophâ hujus loci parte,


quâ demonstratur, Animos esse immortales. Altera pars, quâ
ostenditur, qualis sit ille post hanc vitam status, fabulosé et poeticé à
Platone tractata est.” &c.

111 Skolion of Kallistratus, Antholog. Græc. p. 155. Isokrates,


Encomium Helenæ, Or. x. s. 70-72. Compare the Νέκυια of the
Odyssey and that of the Æneid, respecting the heroes —
“Quæ gratia currûm
Armorumque fuit vivis, quæ cura nitentes
Pascere equos, eadem sequitur tellure repostos.” (Æn. vi. 653-5.)

The Philosopher, as a recompense for


The philosopher will enjoy
having detached himself during life as
an existence of pure soul
much as possible from the body and all
unattached to any body.
its functions, will be admitted after
death to existence as a soul pure and simple, unattached to any
body. The souls of all other persons, dying with more or less of the
taint of the body attached to each of them,112 and for that reason
haunting the tombs in which the bodies are buried, so as to become
visible there as ghosts — are made subject, in the Platonic Hades, to
penalty and purification suitable to the respective condition of each;
after which they become attached to new bodies, sometimes of men,
sometimes of other animals. Of this distributive scheme it is not
possible to frame any clear idea, nor is Plato consistent with himself
except in a few material features. But one feature there is in it which
stands conspicuous — the belief in the metempsychosis, or transfer
of the same soul from one animal body to another: a belief very
widely diffused throughout the ancient world, associated with the
immortality of the soul, pervading the Orphic and Pythagorean
creeds, and having its root in the Egyptian and Oriental religions.113

112 Plato, Phædon, p. 81 C-D. ὃ δὴ καὶ ἔχουσα ἡ τοιαύτη ψυχὴ


βαρύνεται τε καὶ ἕλκεται πάλιν εἰς τὸν ὁρατὸν τόπον, φόβῳ τοῦ
ἀειδοῦς τε καὶ Ἅιδου, ὥσπερ λέγεται, περὶ τὰ μνήματά τε καὶ τοὺς
τάφους καλινδουμένη· περὶ ἃ δὴ καὶ ὤφθη ἅττα ψυχῶν σκιοειδῆ
φαντάσματα οἷα παρέχονται αἱ τοιαῦται ψυχαὶ εἴδωλα, αἱ μὴ καθαρῶς
ἀπολυθεῖσαι, ἀλλὰ τ ο ῦ ὁ ρ α τ ο ῦ μ ε τ έ χ ο υ σ α ι , δ ι ὸ κ α ὶ
ὁρῶνται.
Lactantius — in replying to the arguments of Demokritus, Epikurus,
and Dikæarchus against the immortality of the soul — reminded
them that any Magus would produce visible evidence to refute them;
by calling up before them the soul of any deceased person to give
information and predict the future — “qui profecto non auderent de
animarum interitu mago praesente disserere, qui sciret certis
carminibus cieri ab infernis animas et adesse et præbere se videndas
et loqui et futura prædicere: et si auderent, re ipsâ et documentis
præsentibus vincerentur” (Lactant. Inst. vii. 13). See Cicero, Tusc.
Disp. i. 31.

113 Compare the closing paragraph of the Platonic Timæus: Virgil,


Æneid vi. 713, Herodot. ii. 123, Pausanias, iv. 32, 4, Sextus Empiric.
adv. Math. ix. 127, with the citation from Empedokles:—

“Tum pater Anchises: ‘Animæ quibus altera fato


Corpora debentur, Lethæi ad fluminis undam
Securos latices et longa oblivia potant’.”

The general doctrine, upon which the Metempsychosis rests, is set


forth by Virgil in the fine lines which follow, 723-751; compare
Georgic iv. 218. The souls of men, beasts, birds, and fishes, are all of
them detached fragments or portions from the universal soul, mind,
or life, ætherial or igneous, which pervades the whole Kosmos. The
soul of each individual thus detached to be conjoined with a distinct
body, becomes tainted by such communion; after death it is purified
by penalties, measured according to the greater or less taint, and
becomes then fit to be attached to a new body, yet not until it has
drunk the water of Lêthê (Plato, Philêbus, p. 30 A; Timæus, p. 30 B).

The statement of Nemesius is remarkable, that all Greeks who


believed the immortality of the soul, believed also in the
metempsychosis — Κοινῇ μὲν οὖν πάντες Ἔλληνες, οἱ τὴν ψυχὴν
ἀθάνατον ἀποφῃνάμενοι, τὴν μετενσωμάτωσιν δογματίζουσιν (De
Naturâ Hominis, cap. ii. p. 50, ed. 1565). Plato accepted the Egyptian
and Pythagorean doctrine, continued in the Orphic mysteries (Arnob.
adv. Gentes, ii. 16), making no essential distinction between the
souls of men and those of animals, and recognising reciprocal
interchange from the one to the other. The Platonists adhered to this
doctrine fully, down to the third century A.D., including Plotinus,
Numenius, and others. But Porphyry, followed by Jamblichus,
introduced a modification of this creed, denying the possibility of
transition of a human soul into the body of another animal, or of the
soul of any other animal into the body of a man, — yet still
recognising the transition from one human body to another, and from
one animal body to another. (See Alkinous, Introd. in Platon. c. 25.)
This subject is well handled in a learned work published in 1712 by a
Jesuit of Toulouse, Michel Mourgues. He shows (in opposition to
Dacier and others, who interpreted the doctrine in a sense merely
spiritual and figurative) that the metempsychosis was a literal belief
of the Platonists down to the time of Proklus. “Les quatre
Platoniciens qui ont tenu la Transmigration bornée” (i.e. from one
human body into another human body) “n’ont pas laissé d’admettre
la pluralité d’animations ou de vies d’une même âme: et cela sans
figure et sans métaphore. Cet article, qui est l’essentiel, n’a jamais
trouvé un seul contradicteur dans les sectes qui ont cru l’âme
immortelle: ni Porphyre, ni Hiérocle, ni Procle, ni Salluste, n’ont
jamais touché à ce point que pour l’approuver. D’où il suit que la
réalité de la Métempsychose est indubitable; c’est à dire, qu’il est
indubitable que tous les sectateurs de Pythagore et de Platon l’ont
soutenue dans un sens très réel quant à la pluralité des vies et
d’animations” (Tom. i. p. 525: also Tom. ii. p. 432) M. Cousin and M.
Barthélemy St Hilaire are of the same opinion.
M. Barthélemy St. Hilaire observes in his Premier Mémoire sur le
Sankhyâ p. 416, Paris, 1852.

“Voilà donc la transmigration dans les plus grands dialogues de


Platon — le Timée, la République, le Phèdre, le Phédon. On peut en
retrouver la trace manifeste dans d’autres dialogues moins
considérables, le Menon et le Politique, par exemple. La
transmigration est même positivement indiquée dans le dixième Livre
des Lois, où Platon traite avec tant de force et de solennité de la
providence et de la justice divines.

“En présence de témoignages si sérieux, et de tant de persistance


à revenir sur des opinions qui ne varient pas, je crois que tout esprit
sensé ne peut que partager l’avis de M. Cousin. Il est impossible que
Platon ne se fasse de l’exposition de ces opinions qu’un pur
badinage. Il les a répetées, sans les modifier en rien, au milieu des
discussions les plus graves et les plus étendues. Ajoutez que ces
doctrines tiennent intimément à toutes celles qui sont le fond même
du platonisme, et qu’elles s’y entrelacent si étroitement, que les en
détacher, c’est le mutiler et l’amoindrir. Le système des Idées ne se
comprend pas tout entier sans la réminiscence: et la réminiscence
elle même implique necessairement l’existence antérieure de l’âme.”

Dr. Henry More, in his ‘Treatise on the Immortality of the Soul,’


argues at considerable length in defence of pre-existence of each
soul, as a part of the doctrine. He considers himself to have clearly
proved — “That the pre-existence of the soul is an opinion both in
itself the most rational that can be maintained, and has had the
suffrage of the most renowned philosophers in all ages of the world”.
Of these last-mentioned philosophers he gives a list, as follows —
Moses, on the authority of the Jewish Cabbala — Zoroaster,
Pythagoras, Epicharmus, Empedocles, Cebês, Euripides, Plato, Euclid,
Philo, Virgil, Marcus Cicero, Plotinus, Jamblichus, Proclus, Boethius,
&c. See chapters xii. and xiii. pages 116, 117, 121 of his Treatise.
Compare also what he says in Sect. 18 of his Preface General, page
xx.-xxiv.

We are told that one vehement


Plato’s demonstration of
admirer of Plato — the Ambrakiot
the immortality of the soul
Kleombrotus — was so profoundly
did not appear satisfactory
affected and convinced by reading the
to subsequent
Phædon, that he immediately
philosophers. The question
terminated his existence by leaping
remained debated and
from a high wall; though in other
problematical.
respects well satisfied with life. But the
number of persons who derived from it such settled conviction, was
certainly not considerable. Neither the doctrine nor the reasonings of
Plato were adopted even by the immediate successors in his school:
still less by Aristotle and the Peripatetics — or by the Stoics — or by
the Epikureans. The Epikureans denied altogether the survivorship of
soul over body: Aristotle gives a definition of the soul which involves
this same negation, though he admits as credible the separate
existence of the rational soul, without individuality or personality. The
Stoics, while affirming the soul to be material as well as the body,
considered it as a detached fragment of the all-pervading cosmical or
mundane soul, which was re-absorbed after the death of the
individual into the great whole to which it belonged. None of these
philosophers were persuaded by the arguments of Plato. The popular
orthodoxy, which he often censures harshly, recognised some sort of
posthumous existence as a part of its creed; and the uninquiring
multitude continued in the teaching and traditions of their youth. But
literary and philosophical men, who sought to form some opinion for
themselves without altogether rejecting (as the Epikureans rejected)
the basis of the current traditions — were in no better condition for
deciding the question with the assistance of Plato, than they would
have been without him. While the knowledge of the bodily organism,
and of mind or soul as embodied therein, received important
additions, from Aristotle down to Galen — no new facts either were
known or could become known, respecting soul per se, considered as
pre-existent or post-existent to body. Galen expressly records his
dissatisfaction with Plato on this point, though generally among his
warmest admirers. Questions of this kind remained always
problematical, standing themes for rhetoric or dialectic.114 Every man
could do, though not with the same exuberant eloquence, what Plato
had done — and no man could do more. Every man could coin his
own hopes and fears, his own æsthetical preferences and
repugnances, his own ethical aspiration to distribute rewards and
punishments among the characters around him — into affirmative
prophecies respecting an unknowable future, where neither
verification nor Elenchus were accessible. The state of this discussion
throughout the Pagan world bears out the following remark of Lord
Macaulay, with which I conclude the present chapter:—

“There are branches of knowledge with respect to which the law of


the human mind is progress.… But with theology, the case is very
different. As respects natural religion — revelation being for the
present altogether left out of the question — it is not easy to see that
a philosopher of the present day is more favourably situated than
Thales or Simonides.… As to the other great question — the
question, what becomes of man after death — we do not see that a
highly educated European, left to his unassisted reason, is more
likely to be in the right than a Blackfoot Indian. Not a single one of
the many sciences in which we surpass the Blackfoot Indians, throws
the smallest light on the state of the soul after the animal life is
extinct. In truth, all the philosophers, ancient and modern, who have
attempted, without the help of revelation, to prove the immortality of
man — from Plato down to Franklin — appear to us to have failed
deplorably. Then again, all the great enigmas which perplex the
natural theologian are the same in all ages. The ingenuity of a people
just emerging from barbarism, is quite sufficient to propound them.
The genius of Locke or Clarke is quite unable to solve them.…
Natural Theology, then, is not a progressive science.”115

114 Seneca says, Epist. 88. “Innumerabiles sunt quæstiones de


animo: unde sit, qualis sit, quando esse incipiat, quamdiu sit; an
aliunde aliò transeat, et domicilium mutet, ad alias animalium formas
aliasque conjectus, an non amplius quam semel serviat, et emissus
evagetur in toto; utrum corpus sit, an non sit: quid sit facturus, quum
per nos aliquid facere desierit: quomodo libertate usurus, cum ex hâc
exierit caveâ: an obliviscatur priorum et illic nosse incipiat, postquam
de corpore abductus in sublime secessit.” Compare Lucretius, i. 113.

115 Macaulay, Ranke’s History of the Popes (Crit. and Hist. Essays,
vol. iii. p. 210). Sir Wm. Hamilton observes (Lectures on Logic, Lect.
26, p. 55): “Thus Plato, in the Phædon, demonstrates the immortality
of the soul from its simplicity: in the Republic, he demonstrates its
simplicity from its immortality.”
END OF VOL. II.

Transcriber’s Note

This HTML version was prepared initially for the on-line Grote
Project by Ed Brandon from volumes in the Internet Archive. It owes
a very great deal (its style sheet) to the Project Gutenberg versions
of the 1911 Encyclopedia Britannica produced by Don Kretz and
others. Don provided a revised style for the side-notes to
accommodate Grote’s predilection for very long notes. (Even so there
are a few occasions where the appearance may yet be bad in some
browsers because the side-note extends over more lines than its
accompanying paragraph. If there are also footnotes in the
paragraph I have had to guess at how much blank space should be
inserted for the footnote not to overlap the side-note.) I have
modified it in one respect to permit Grote’s use of italics in some
side-notes.
*** END OF THE PROJECT GUTENBERG EBOOK PLATO AND THE
OTHER COMPANIONS OF SOKRATES, 3RD ED. VOLUME 2 ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like