Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
<!DOCTYPE html>
<html lang="en">
<title>Animation easings - Azure Maps Web SDK Samples</title>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico"/>
<meta http-equiv="x-ua-compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="This sample demonstrates the different built in easing functions in the azure-maps-animation library." />
<meta name="keywords" content="Microsoft maps, map, gis, API, SDK, animation, animate, animations, point, symbol, pushpin, marker, pin, easing" />
<meta name="author" content="Microsoft Azure Maps" />
<!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->
<link rel="stylesheet" href="" type="text/css" />
<script src=""></script>
<!-- Loading in a charting library for the sample. -->
<link rel="stylesheet" href="" type="text/css" />
<script src=""></script>
<!-- Add reference to the animation module. -->
<script src="../Common/scripts/azure-maps-animations.min.js"></script>
<script type='text/javascript'>
var map, point;
function GetMap() {
//Point the Azure Maps domain to the US Azure Gov Cloud domain.
//Initialize a map instance.
map = new atlas.Map('myMap', {
zoom: 3,
pitch: 60,
view: 'Auto',
//Add authentication details for connecting to Azure Maps.
authOptions: {
//Use Azure Active Directory authentication.
authType: 'anonymous',
clientId: 'c9f2f391-13f1-407b-a4a5-f0a241bacfbf', //Your Azure Active Directory client id for accessing your Azure Maps account.
getToken: function (resolve, reject, map) {
//URL to your authentication service that retrieves an Azure Active Directory Token.
var tokenServiceUrl = '';
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
//Alternatively, use an Azure Maps key. Get an Azure Maps key at NOTE: The primary key should be used as the key.
//authType: 'subscriptionKey',
//subscriptionKey: '<Your Azure Maps Key>'
//Wait until the map resources are ready.'ready', function () {
point = new atlas.Shape(new[0,0]));
//Create a data source and add it to the map.
datasource = new atlas.source.DataSource();
//Add the data to the data source.
//Add a layer for rendering point data. This could be any layer that supports rendering point data.
map.layers.add(new atlas.layer.SymbolLayer(datasource, null, {
iconOptions: {
offset: ['get', 'offset'],
//For smoother animation, ignore the placement of the icon. This skips the label collision calculations and allows the icon to overlap map labels.
ignorePlacement: true,
//For smoother animation, allow symbol to overlap all other symbols on the map.
allowOverlap: true
//Load the easing function dropdown
//Get a list of the easing functions.
var html = ['<option value=""></option>'];
atlas.animations.getEasingNames().forEach(e => {
html.push(`<option value="${e}">${e}</option>`);
document.getElementById('easingFns').innerHTML = html.join('');
//Initialize the chart.
easingChart = new Chart(document.getElementById('easingChart'), {
type: 'line',
data: {
labels: xAxis
options: {
legend: {
display: false
elements: {
line: {
fill: false,
borderColor: 'red',
radius: 0
responsive: true,
title: {
display: false
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Progress'
yAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Value'
var xAxis = [0,0.1, 0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1];
var easingChart;
var easing;
var animation;
function easingChanged(elm){
//Chart the easing function.
easingName = elm.value;
var easingFn = atlas.animations.getEasingFn(easingName);
var data = [];
for(var i = 0; i < xAxis.length; i++){
}[0] = {
data: data
//Animate the point to a new random location using the easing function.
var randomPos = [Math.random() * 360 - 180, Math.random() * 170 - 85];
animation = atlas.animations.drop(point, null, null, {
duration: 2000,
easing: easingName,
autoPlay: true
<body onload="GetMap()">
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div>
<div style="position:absolute;top:15px;left:15px;border-radius:5px;padding:5px;background-color:white;">
<select id="easingFns" onchange="easingChanged(this)"></select>
<input type="button" value="Play" onclick="easingChanged()"/>
<div style="display:block;width:250px;height:250px;">
<canvas id="easingChart" style="display:block;width:250px;height:250px;" width="250" height="250"></canvas>
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">
<legend><h1 style="font-size:16px">Animation easings</h1></legend>
This sample demonstrates the different built in easing functions in the Azure Maps animation module.
This sample uses the open source <a href="" target="_blank">Azure Maps Animation module</a>