added marker-animate-unobtrusive library

This commit is contained in:
viskin
2016-08-11 14:40:11 +03:00
parent df11fe36a1
commit d16e4caf67
3 changed files with 127 additions and 0 deletions
@@ -0,0 +1,5 @@
import SlidingMarker = require('SlidingMarker');
import MarkerWithGhost = require('MarkerWithGhost');
SlidingMarker.initializeGlobally();
MarkerWithGhost.initializeGlobally();
@@ -0,0 +1,50 @@
/// <reference path="../googlemaps/google.maps.d.ts" />
/// <reference path='./marker-animate-unobtrusive.d.ts' />
function test_init() {
SlidingMarker.initializeGlobally();
MarkerWithGhost.initializeGlobally();
}
function test_options() {
var options: SlidingMarkerOptions = {
position: new google.maps.LatLng(0, 0),
easing: "easeInOutSine",
duration: 1000,
animateFunctionAdapter: (marker, destPoint, easing, duration) => {}
};
var m = new SlidingMarker(options);
var g = new MarkerWithGhost(options);
}
function test_sliding_marker() {
let googleMarker: google.maps.Marker;
let p: google.maps.LatLng;
let d: number;
let e:jQuery.easing.IEasingType;
var m = new SlidingMarker();
googleMarker = m;
p = m.getPosition();
m.setDuration(d);
d = m.getDuration();
m.setEasing(e);
e = m.getEasing();
p = m.getAnimationPosition();
m.setPositionNotAnimated(p);
}
function test_marker_with_ghost() {
let p: google.maps.LatLng;
let d: number;
let e:jQuery.easing.IEasingType;
let slidingMarker: SlidingMarker;
var g = new MarkerWithGhost();
slidingMarker = g;
g.setGhostPosition(p);
p = g.getGhostPosition();
p = g.getGhostAnimationPosition();
}
@@ -0,0 +1,72 @@
// Type definitions for marker-animate-unobtrusive 0.2.8
// Project: https://github.com/terikon/marker-animate-unobtrusive
// Definitions by: Roman Viskin <https://github.com/viskin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../googlemaps/google.maps.d.ts" />
declare namespace jQuery.easing {
type IEasingType =
'swing' |
'easeInQuad' |
'easeOutQuad' |
'easeInOutQuad' |
'easeInCubic' |
'easeOutCubic' |
'easeInOutCubic' |
'easeInQuart' |
'easeOutQuart' |
'easeInOutQuart' |
'easeInQuint' |
'easeOutQuint' |
'easeInOutQuint' |
'easeInSine' |
'easeOutSine' |
'easeInOutSine' |
'easeInExpo' |
'easeOutExpo' |
'easeInOutExpo' |
'easeInCirc' |
'easeOutCirc' |
'easeInOutCirc' |
'easeInElastic' |
'easeOutElastic' |
'easeInOutElastic' |
'easeInBack' |
'easeOutBack' |
'easeInOutBack' |
'easeInBounce' |
'easeOutBounce' |
'easeInOutBounce';
}
interface SlidingMarkerOptions extends google.maps.MarkerOptions {
easing?: jQuery.easing.IEasingType,
duration?: number,
animateFunctionAdapter?: (marker: google.maps.Marker, destPoint: google.maps.LatLng, easing: 'linear' | jQuery.easing.IEasingType, duration: number) => void
}
declare class SlidingMarker extends google.maps.Marker {
static initializeGlobally(): void;
constructor(opts?: SlidingMarkerOptions);
setDuration(duration: number);
getDuration(): number;
setEasing(easing: jQuery.easing.IEasingType);
getEasing(): jQuery.easing.IEasingType;
getAnimationPosition(): google.maps.LatLng;
setPositionNotAnimated(position: google.maps.LatLng | google.maps.LatLngLiteral): void;
}
declare class MarkerWithGhost extends SlidingMarker {
setGhostPosition(ghostPosition: google.maps.LatLng | google.maps.LatLngLiteral);
getGhostPosition(): google.maps.LatLng;
getGhostAnimationPosition(): google.maps.LatLng;
}
declare module "SlidingMarker" {
export = SlidingMarker;
}
declare module "MarkerWithGhost" {
export = MarkerWithGhost;
}