Simple Animation with the Java 3D API Wisconsin

Learn how to use the RotationInterpolator and Alpha classes of the Java 3D API, along with other necessary classes, to write simple animation programs. Also learn the rationale by which those classes are used to write animation programs.

Local Companies

Acumium
608 310 9700 x 522
5133 West Terrace Drive Suite 300
Madison, , WI
Xorbix Technologies Inc.
414-277-5044
759 N. Milwaukee St.
Milwaukee, WI
R.E. Coker and Associates, Inc.
262-723-8104
108 W Court St.
Elkhorn, WI
Electroniclaim
262-240-9700
11357 N. Port Washington Rd
Mequon, WI
R S InfoCon, Inc.
262-898-7456
2320 Renaissance Blvd
Sturtevant, WI
HarrisData
262-784-9099
13555 Bishop's Court, Suite 300
Brookfield, WI
IFS
414-577-5191
12000 W. Park Place
Milwaukee, WI
Wireless Direct
1.866.707.8498
BOX 71101
shorewood, WI
HarrisData
800-225-0585
13555 Bishops Court
Brookfield, WI
Visionary Computer Solutions
262-365-9430
PO Box 406
Grafton, WI

Simple Animation with the Java 3D API

provided by: 
Originally published at Internet.com


Java Programming Notes #1544 * Preface * General * Acknowledgement * Viewing tip * Figures * Listings * Supplementary material * General background information * Preview * Discussion and sample code * Run the program * Summary * What's next? * Download * Resources * Complete program listing * Copyright * About the author -----------------------------------

Preface

General

Third in a series of lessons

This is the third lesson in a series of lessons designed to start with Java 3D basics and work up to the general complexity of the program that I explained in the earlier lesson titled "Understanding Lighting in the Java 3D API" (see Resources).

The first lesson in this series was titled "Back to Basics in the Java 3D API" (see Resources). The previous lesson was titled "Digging a Little Deeper into the Java 3D API." This lesson is titled "Simple Animation with the Java 3D API." My current plan is for future lessons to deal with the detailed behavior of an Alpha time-base object, user and object interaction as well as advanced animation and textures.

What you will learn

In this lesson, I will teach you how to use the RotationInterpolator and Alpha classes of the Java 3D API, along with other necessary classes, to write a simple animation program. I will also explain the rationale by which those classes are used to write animation programs.

Compiling and running Java 3D programs

In order to compile and run programs using the Java 3D API, you will need to download and install the Java 3D API software. As of the date of this writing, version 1.5.0 is available for download.

In addition, you will need to download and install either Microsoft DirectX or OpenGL. All of the sample programs in this series of tutorials were developed and tested using Microsoft DirectX. They were not tested using OpenGL.

Acknowledgement

Much of what I will be teaching you about the use of the Java 3D API was learned by studying the tutorial by Dennis J Bouvier (see Resources) along with other online material, some of which is also listed in Resources.

You can view the Bouvier tutorial online. You can also download the Bouvier tutorial as a set of PDF files along with the source code for the example programs in his tutorial.

Viewing tip

I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the figures and listings while you are reading about them.

Figures

* Figure 1. Bouvier's recipe for animation in Java 3D. * Figure 2. Four screen shots from the running animation program. * Figure 3. A screen shot from the original program. * Figure 4. New location for the white sphere. * Figure 5. Class/subclass hierarchy for the Interpolator class. * Figure 6. One of two RotationInterpolator constructors.

Listings

* Listing 1. The beginning of the program named Java3D005. * Listing 2. Create the small white sphere in a different location. * Listing 3. More code with no changes. * Listing 4. Code with an expanded purpose. * Listing 5. Some modified code. * Listing 6. Beginning of the code that implements the animation. * Listing 7. Create an Alpha object. * Listing 8. Create a RotationInterpolator object. * Listing 9. Specify the active animation region. * Listing 10. Construct the entire BranchGroup object. * Listing 11. Wrap it up. * Listing 12. Program listing for the program named Java3D005.

Supplementary material

I recommend that you also study the other lessons in my extensive collection of online Java tutorials. You will find a consolidated index at www.DickBaldwin.com.

General background information

The need to understand animation

It seems that one of the first things that programming students want to do these days is to write game programs. Modern game programs almost always involve animation. Therefore, before a student can write a game program, that student must understand animation (in addition to many other important programming concepts). What is animation
According to Bouvier, "The distinction between animation and interaction is whether the behavior is activated in response to the passing of time or in response to user activities..." By this, he means that animation behavior is in response to the passage of time whereas interactive behavior is in response to user activities.

Animation versus interactive behavior

In reality, most modern game programs involve both animation and interaction (see the sidebar). This lesson will deal with animation. Interactive behavior using the Java 3D API will be reserved for a future lesson.

Simple versus advanced animation

Animation can involve some very complex programming concepts. Fortunately, simple animation is relatively easy to achieve using the Java 3D API once you understand the required structure. This lesson will concentrate on simple animation for the purpose of exposing the underlying capabilities of Java 3D in this regard. Advanced animation behavior will be reserved for a future lesson.

Bouvier's recipe for animation in Java 3D

Although it's not the only way to create animation, one way to create animation in Java 3D is through the use an Interpolator object.

Author: Richard G. Baldwin

Read article at Internet.com site

Featured Local Company

Wireless Direct

1.866.707.8498
BOX 71101
shorewood, WI
http://www.prepaidwireless.2ya.com

Related Articles
- Understanding the Alpha Time-Base Class in Java 3D Wisconsin
Understanding the Alpha class is critical to understanding Java 3D animation. The constructors for the Alpha class can require up to ten parameters. Learn about the detailed behavior of objects instantiated from the Alpha class, with particular emphasis on understanding the behavior imparted by each of the ten parameters.
- Graphics, using Java and JDOM with SVG, Part 1 Wisconsin
- Combining Rotation and Translation in Java 3d Wisconsin
- Understanding Transforms in Java 2D Wisconsin
- JavaOne Spotlight: JavaFX Script Wisconsin
- Using the Full-Screen Exclusive Mode API in Java Wisconsin
- Understanding Transforms in Java 3D Wisconsin
- Microsoft Liquid Motion Animation Wisconsin
Regional Articles
- Simple Animation with the Java 3D API Appleton WI
- Simple Animation with the Java 3D API Baraboo WI
- Simple Animation with the Java 3D API Beaver Dam WI
- Simple Animation with the Java 3D API Beloit WI
- Simple Animation with the Java 3D API Brookfield WI
- Simple Animation with the Java 3D API Burlington WI
- Simple Animation with the Java 3D API Cedarburg WI
- Simple Animation with the Java 3D API Chippewa Falls WI
- Simple Animation with the Java 3D API Cudahy WI
- Simple Animation with the Java 3D API De Pere WI
- Simple Animation with the Java 3D API Delavan WI
- Simple Animation with the Java 3D API Eau Claire WI
- Simple Animation with the Java 3D API Elkhorn WI
- Simple Animation with the Java 3D API Fond Du Lac WI
- Simple Animation with the Java 3D API Fort Atkinson WI
- Simple Animation with the Java 3D API Franklin WI
- Simple Animation with the Java 3D API Green Bay WI
- Simple Animation with the Java 3D API Hartland WI
- Simple Animation with the Java 3D API Janesville WI
- Simple Animation with the Java 3D API Kaukauna WI
- Simple Animation with the Java 3D API Kenosha WI
- Simple Animation with the Java 3D API La Crosse WI
- Simple Animation with the Java 3D API Lake Geneva WI
- Simple Animation with the Java 3D API Manitowoc WI
- Simple Animation with the Java 3D API Marinette WI
- Simple Animation with the Java 3D API Marshfield WI
- Simple Animation with the Java 3D API Menasha WI
- Simple Animation with the Java 3D API Menomonee Falls WI
- Simple Animation with the Java 3D API Menomonie WI
- Simple Animation with the Java 3D API Merrill WI
- Simple Animation with the Java 3D API Middleton WI
- Simple Animation with the Java 3D API Milwaukee WI
- Simple Animation with the Java 3D API Mosinee WI
- Simple Animation with the Java 3D API Mukwonago WI
- Simple Animation with the Java 3D API Muskego WI
- Simple Animation with the Java 3D API Neenah WI
- Simple Animation with the Java 3D API New Berlin WI
- Simple Animation with the Java 3D API Oak Creek WI
- Simple Animation with the Java 3D API Oconomowoc WI
- Simple Animation with the Java 3D API Onalaska WI
- Simple Animation with the Java 3D API Oshkosh WI
- Simple Animation with the Java 3D API Pewaukee WI
- Simple Animation with the Java 3D API Racine WI
- Simple Animation with the Java 3D API Rhinelander WI
- Simple Animation with the Java 3D API Rice Lake WI
- Simple Animation with the Java 3D API River Falls WI
- Simple Animation with the Java 3D API Schofield WI
- Simple Animation with the Java 3D API Shawano WI
- Simple Animation with the Java 3D API Sheboygan WI
- Simple Animation with the Java 3D API South Milwaukee WI
- Simple Animation with the Java 3D API Stevens Point WI
- Simple Animation with the Java 3D API Sturgeon Bay WI
- Simple Animation with the Java 3D API Sun Prairie WI
- Simple Animation with the Java 3D API Superior WI
- Simple Animation with the Java 3D API Thiensville WI
- Simple Animation with the Java 3D API Two Rivers WI
- Simple Animation with the Java 3D API Watertown WI
- Simple Animation with the Java 3D API Waukesha WI
- Simple Animation with the Java 3D API Waupaca WI
- Simple Animation with the Java 3D API Wausau WI
- Simple Animation with the Java 3D API West Bend WI
- Simple Animation with the Java 3D API Whitewater WI
- Simple Animation with the Java 3D API Wisconsin Rapids WI
Related Articles
- Graphics, using Java and JDOM with SVG, Part 1 Wisconsin
Learn a little about JDOM as an alternative to Sun's JAXP DOM API. Learn how to create an SVG file using raw JDOM commands. Learn how to write a Java/JDOM/SVG graphics library to reduce the effort required to create SVG files using JDOM and Java.
- JavaOne Spotlight: JavaFX Script Wisconsin
- Understanding the Alpha Time-Base Class in Java 3D Wisconsin
- Understanding Transforms in Java 3D Wisconsin
- Microsoft Liquid Motion Animation Wisconsin
- Using the Full-Screen Exclusive Mode API in Java Wisconsin
- Combining Rotation and Translation in Java 3d Wisconsin
- Understanding Transforms in Java 2D Wisconsin
Related Local Events
2008 Early Stage Symposium
Dates: 11/5/2008 - 11/6/2008
Location: Monona Terrace
Madison WI
View Details

Wisconsin Entrepreneurs' Conference
Dates: 6/9/2008 - 6/10/2008
Location: Hyatt Regency Hotel
Milwaukee WI
View Details
Rate Article
     
Articles Insider

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Advertising Engineering Home Services Retail & Consumer Services
Business Services Entertainment Industrial Goods & Services Software
Career Family Insurance Technology
Cars Financial Services Internet Telecommunications
Computer Hardware Food & Beverage Legal Transportation & Logistics
Construction Health Pets Travel
Education Home Electronics Real Estate Wedding