You can control the visibility of a Placemark, Path or Polygon, all through the magic of KML. A popular use looks like this:
Polygon Fade in
Here are the steps involved. We are going to use a Polygon, since they are commonly used for this kind of thing:
1. Build your Polygon - in Google Earth, build yourself a Polygon and set up the style how you like it.
A fine Polygon example
2. Open up the Polygon in a text editor - commonly used editors are SCiTE (PC) or TextWrangler (MAC), both free
3. Find the data we are interested in - you want to get the style colors and the geometry:
Find the style information near the top, looks like this:
...
<Style id="style-a">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>bf0000ff</color> (copy this Polygon line color data)
<width>3</width> (copy this Polygon line width data)
</LineStyle>
<PolyStyle>
<color>4c0000ff</color> (copy this Polygon fill color data)
</PolyStyle>
<visibility>0</visibility>
</Style>
...
Find the Polygon geometry information closer to the bottom, looks like this:
...
<Placemark>
<name>Olympic Park</name>
<styleUrl>#style-a</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-0.02652213958092231,51.54810249739627,... (copy ALL the geometry data here)
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
...
3. Open the appropriate template file - located at the bottom of this page. For this example we used the fade-on-polygon.kml.
4. Put your polygon data in the Template file - copy and paste the style information and geometry information into the template file.
...
<gx:AnimatedUpdate>
<gx:duration>5</gx:duration>
<Update>
<Change>
</Placemark>
<Style targetId="poly_style_01">
<LineStyle>
<color>bfff0000</color> (paste your desired Polygon line color data)
<width>3</width> (paste your desired width here data)
</LineStyle>
<PolyStyle>
<color>4c0000ff</color> (paste your desired Polygon fill data color here)
</PolyStyle>
</Style>
</Change>
</Update>
</gx:AnimatedUpdate>
...
...
<Placemark id="polygon_name">
<name>Olympic Park</name> (you can name your polygon if you want to here)
<visibility>0</visibility>
<styleUrl>#poly_style_01</styleUrl>
<Polygon>
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>relativeToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-0.02652213958092231,51.54810249739627,0.02427897150575342,... (paste the geometry data here)
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
...
After you've done that, your template file is now your Polygon fade tour, so save it and...
5. Open up the KML in Google Earth and see how it looks -
Polygon fading in
6. Changing the length of the fade - you can increase or decrease the time the polygon takes to fade in.
<gx:AnimatedUpdate>
<gx:duration>5</gx:duration> (change the duration of the fade here)
<Update>
<targetHref></targetHref>
<Change>
<Placemark targetId="path_name">
<visibility>1</visibility>
</Placemark>
<Style targetId="path_style">
<LineStyle>
<color>bfff0000</color>
<width>3</width>
</LineStyle>
<PolyStyle>
<color>4c0000ff</color>
</PolyStyle>
</Style>
</Change>
</Update>
</gx:AnimatedUpdate>
<gx:Wait> <gx:duration>5</gx:duration></gx:Wait> (also change it here!)
What is going on with that <gx:Wait> tag? The <gx:Wait> and <gx:FlyTo> tags are the only tags that advance the tour, so without them the <gx:AnimatedUpdate> tags will have no effect. for every <gx:AnimatedUpdate> there must be a <gx:Wait> or <gx:FlyTo> tag of equal or greater length after it.
7. Paths, Placemarks, and Overlays - you can also fade in many other kinds of features, like Paths, Placemarks and even Image Overlays!
Controlling these will be similar to the Polygon, with only minor differences. The important thing is to copy your feature data into the correct template file.
Some considerations:
Save and test your file often to easily spot where errors may have been made
You can put multiple <gx:AnimatedUpdate> tags into one tour file, so many things come on at once. Be sure the appropriate <gx:Wait> tags are in place.
You can set the duration of the <gx:AnimatedUpdate> tag to zero and the fade will just snap on
You can put <gx:delayedStart>1</gx:delayedStart> before the <gx:duration>1</gx:duration> of the <gx:AnimatedUpdate> to delay the start of the action.
The time for delayed start + animated update must be equal or shorter than the following <gx:Wait> or <gx:FlyTo> to give the action time to complete.
<gx:AnimatedUpdate>
<gx:delayedStart>3</gx:delayedStart>
<gx:duration>5</gx:duration> (change the duration of the fade here)
<Update>
<targetHref></targetHref>
<Change>
...
</Change>
</Update>
</gx:AnimatedUpdate>
<gx:Wait> <gx:duration>10</gx:duration></gx:Wait> (must be greater than 8 seconds in this case)
Below are examples of fading on various features using a fade:
Placemark icon and label
Placemark icon only
Placemark label only
Path
Image overlay
This is the end of this page, you can stop reading now.