2012-11-16 48 views
5

我在使用Google地球的animated update功能時非常成功,我正在使用它來移動models。我真正想做的是能夠在Google Earth中爲line(例如上下)創建動畫,但我發現這很棘手。使用kml在Google地球中設置線條的動畫效果

我有開始處的線的經度和緯度。例如線的座標:

-88,17,100 -88.20270841086835,17.21899813162266,100

我然後想這條線的raise一端到500的高度在5秒鐘。

我畫使用LineString行:

<Placemark id="path1"> 
    <name>Untitled Path man</name> 
    <LineString> 
     <tessellate>1</tessellate> 
     <coordinates> 
      -88.,17,100 -88.20270841086835,17.21899813162266,100 
     </coordinates> 
    </LineString> 
</Placemark> 

但是我現在丟失如何使用<gx:AnimatedUpdate>一端從100拉昇至500

我敢肯定它很容易 - 可以有人指着我在正確的方向?

回答

5

訣竅是更新LineString元素(帶有一個id)而不是地標。

下面是一個有效的KML示例遊覽,它將動畫從100到500m的相對高度變化的線條動畫化。

<?xml version="1.0" encoding="UTF-8"?> 
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"> 
    <Document> 
     <name>gx:AnimatedUpdate example</name> 
     <open>1</open> 

     <LookAt> 
      <longitude>-88.1351880996469</longitude> 
      <latitude>17.09943637744042</latitude> 
      <altitude>0</altitude> 
      <heading>49.91874373078863</heading> 
      <tilt>84.43764019949967</tilt> 
      <range>1929.311316966288</range> 
      <gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode> 
     </LookAt> 

     <Placemark> 
      <name>Untitled Path man</name> 
      <LineString id="path1"> 
       <tessellate>1</tessellate> 
       <altitudeMode>relativeToGround</altitudeMode> 
       <coordinates> 
      -88,17,100 -88.20270841086835,17.21899813162266,100 
       </coordinates> 
      </LineString> 
     </Placemark> 

     <gx:Tour> 
      <name>Play me!</name> 
      <gx:Playlist> 
       <gx:AnimatedUpdate> 
        <gx:duration>5</gx:duration> 
        <Update> 
         <targetHref/> <!-- Left empty to refer to the current file --> 
         <Change>       
          <LineString targetId="path1"> 
           <coordinates> 
            -88,17,100 -88.20270841086835,17.21899813162266,500    
           </coordinates>       
          </LineString> 
         </Change> 
        </Update> 
       </gx:AnimatedUpdate> 

       <!-- Wait for the animation to complete (see the touring 
       tutorial for an explanation of how AnimatedUpdate's 
       duration isn't enough to guarantee this). --> 
       <gx:Wait> 
        <gx:duration>5.0</gx:duration> 
       </gx:Wait> 
      </gx:Playlist> 
     </gx:Tour> 
    </Document> 
</kml> 

詳見https://developers.google.com/kml/documentation/touring#tourtimelines

+0

回答過的問題,非常感謝 – user1829877

相關問題