Tours and 3D animation
Looking around the various tech reviews of the new Google Earth 5, one new feature seems to have slipped under the radar - the KML tags describing the new touring function include a seriously powerful method for defining smooth motion 3d animation.
I’ve been messing around with this a little, and hacked together a few basic (not much KML code), slightly weird , but dramatic examples. These are tours - view them by loading them into GE and double clicking on play me! in the side panel.
Fly wingman with a 3d model plane (also see the vid above)
How do these work ?
With the new <gx:AnimatedUpdate>. A container for the <Update> element. Which allows you to temporarily modify KML, and specify a length of time for that action to take place over.
Switching features on and off during a tour is the obvious example. Not so apparent, because it’s not directly available through tour recording inside Google Earth, is that for many other changes GE will smoothly interpolate (tween) the difference.
The example Google provide gradually increases the size of a placemark. But this effect can be applied to any KML attribute taking a range of values - orientation, colour, scale and coordinates. Significantly, these transitions will work in parallel, sequentially, across multiple features and alongside scripted camera movements.
This is powerful stuff! A much more convenient and concise method of animation than time slider hacks, where every intermediate step needs coding in KML. Only real downside in all this - and I guess it could be a biggie depending on your needs - you can’t fly around at will during tour playback.
About the examples
- The first uses a single <gx:AnimatedUpdate> to gradually change location of a 3d model over a 60 second duration. Code for this below the fold if anyone wants to check it out.
- Second does the same to transform all 38 coordinates in a polygon.
- Last example combines a series of linestring coordinate transformations with color and scale changes for placemark icons.
KML for the flight hack
<?xml version="1.0" encoding="UTF-8"?>
<!-- Fly to our start location -->
<!-- Change the model's coordinates over a duration of 60 seconds -->
<!-- Move the camera in parallel with the model -->
No related posts.