Book Image

WebGL HOTSHOT

By : Mitch Williams
Book Image

WebGL HOTSHOT

By: Mitch Williams

Overview of this book

Table of Contents (17 chapters)
WebGL HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using WebGL to teach math


The number one selling educational game, or edutainment, back in 1995 was Math Blaster. Children were playing the hero's role, defeating evil, being challenged, having fun, all while they were learning. That game was 2D. It was an obvious match then to use 3D graphics technology to teach math concepts. One advantage of teaching with real-time 3D graphics is that you can experiment with the formulas by changing variables. This next demonstration is not only a practical example of rotations in 3D graphics, but we will also learn how animating rotations of 3D objects works using quaternions.

Prepare for lift off

Before we walk through the code, we need to cover two concepts: animation and rotations with quaternions. Animations can be an object moving, rotating, or scaling in one or more dimensions. Animation has three variables: the beginning transformation, the ending transformation, and a timer. This is also known as key-frame animation where the beginning and ending...