Help us translate this website and improve this translation and earn free licenses!
Anonymous user  |  Log in  |  Create Account

How to...

Movement and animation

To work with movement and animations, we will use the class GMove.
For GMove, 4 properties are defined:
  • deltaMiliseconds: amount of milliseconds that will be left between the previous animation (if it existed) and the one that we are defining.
  • goTO: property of the GLatLon type. It defines which latitude and longitude the map will jump to.
  • deltaX: The increase in X that the map will undergo, where a unit is average screen.
  • deltaY: The increase in Y that the map will undergo, where a unit is average screen.
If goTO is defined, the values given to deltaX and deltaY will be ignored.

Once the movement is defined, the addMovement method will add the movement to the map, as demonstrated in the example.
A map can have as many movements as we want, and the movements will be carried out according to the order in which we have added them to the map.

NOTE: When the beginning and the end of a movement are the sufficiently near, instead of a jump, the map will slide.




Code.aspx
<cc1:GMap ID="GMap1" runat="server" />
Code.aspx.cs
GMove move = new GMove(500, 1, -1);
GMap1.addMovement(move);

GMove move2 = new GMove();
move2.deltaMiliseconds = 2500;
move2.goTo = new GLatLng(51, 44);

GMap1.addMovement(move2);

GMap1.addMovement(new GMove(2500, new GLatLng(51, 20)));

GMap1.addMovement(new GMove(1500, 2, 3));
Powered by Subgurim.NET