All Projects → Igor-Vladyka → Leaflet.motion

Igor-Vladyka / Leaflet.motion

Licence: mit
A simple tool to animate polylines and polygons in different way

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Leaflet.motion

Leaflet Color Markers
color variations of the standard leaflet marker
Stars: ✭ 363 (+377.63%)
Mutual labels:  leaflet, markers
leaflet-tag-filter-button
Adds tag filter control for layers (marker, geojson features etc.) to LeafLet.
Stars: ✭ 48 (-36.84%)
Mutual labels:  leaflet, markers
Prunecluster
Fast and realtime marker clustering for Leaflet
Stars: ✭ 473 (+522.37%)
Mutual labels:  leaflet, markers
vue2-leaflet-rotatedmarker
rotated marker plugin extension for vue2-leaflet package
Stars: ✭ 17 (-77.63%)
Mutual labels:  leaflet, markers
React Move
React Move | Beautiful, data-driven animations for React
Stars: ✭ 6,395 (+8314.47%)
Mutual labels:  motion, move
Show trajectory
This repository collected 3 ways to show trajectory of robot in ROS
Stars: ✭ 48 (-36.84%)
Mutual labels:  markers
Antragsgruen
Managing motions and amendments for political conventions
Stars: ✭ 56 (-26.32%)
Mutual labels:  motion
Material Motion
Starmap and team docs
Stars: ✭ 44 (-42.11%)
Mutual labels:  motion
Maplace.js
A Google Maps Javascript plugin for jQuery.
Stars: ✭ 1,021 (+1243.42%)
Mutual labels:  markers
Amcparser
Parse and visualize asf/amc files from CMU MoCap dataset.
Stars: ✭ 70 (-7.89%)
Mutual labels:  motion
Leaflet Ng2
Angular.io integration of Leaflet
Stars: ✭ 66 (-13.16%)
Mutual labels:  leaflet
Leaflet.draw.drag
Drag feature functionality for Leaflet.draw
Stars: ✭ 56 (-26.32%)
Mutual labels:  leaflet
Papyrusjs
papyrus.js renders maps of Minecraft: Bedrock Edition worlds using node.js, LevelDB and leaflet.
Stars: ✭ 50 (-34.21%)
Mutual labels:  leaflet
Leaflet.basemaps
A tile driven basemaps control for Leaflet.
Stars: ✭ 58 (-23.68%)
Mutual labels:  leaflet
Ngx.leaflet.component
angular 2+ / leaflet 1.x component collection
Stars: ✭ 46 (-39.47%)
Mutual labels:  leaflet
Leaflet.labeltextcollision
Leaflet.LabelTextCollision is a LeafletJS plug-in to display labels on vector data while avoiding label collisions.
Stars: ✭ 65 (-14.47%)
Mutual labels:  leaflet
Svelte Pick A Place
Javascript location picker built with Svelte
Stars: ✭ 44 (-42.11%)
Mutual labels:  leaflet
Leaflet Swoopy
⤵️ Swoopy Arrow Plugin for Leaflet
Stars: ✭ 52 (-31.58%)
Mutual labels:  leaflet
Making Maps With React
🌐 Example React components for React-Leaflet, Pigeon Maps, React MapGL and more
Stars: ✭ 66 (-13.16%)
Mutual labels:  leaflet
Hrcarmarkeranimation
This android library is helpful for google map marker animation with Smooth turn and movement.
Stars: ✭ 52 (-31.58%)
Mutual labels:  markers

Animation Plugin for Leaflet.js

npm version

General information

A leaflet plugin which allows users to apply animation.

Downloads

NPM

npm install --save leaflet.motion

YARN

yarn add leaflet.motion

Usage

Include script:

<script src="dist/leaflet.motion.min.js"></script>

Main options:

L.motion.polyline([], options, motionOptions, markerOptions).addTo(map); //  as L.polyline
L.motion.polygon([], options, motionOptions, markerOptions).addTo(map); //  as L.polygon
L.motion.group([], options).addTo(map); //  as L.featureGroup - to run all animation at same time
L.motion.seq([], options).addTo(map); //  as L.featureGroup - to setup seq for animations.

Options:

You can pass a number of options to the plugin to control various settings.

Default control options

Option Type Default Description
pane Pane 'polymotionPane' Default pane

Motion options

Option Type Default Description
auto Boolean false Indicates auto start animation when motion object added to the map
easing L.Motion.Ease L.Motion.Ease.linear Animation strategy
speed Number 0 Motion speed in KM/H
duration Number 0 Motion duration in ms, 0 means no animation, instant rendering on motionStart()

Marker options

All MarkerOptions that you can add to any marker + one more:

Option Type Default Description
removeOnEnd Boolean false Removes marker from map on motion end
showMarker Boolean false Add marker to the map on first line point when motion just added(start can be delayed) to the map

Here's an example of passing through some options:

L.motion.polyline([[50,0], [60,10]], {
	color: "transparent"
}, {
	auto: true,
	duration: 3000,
	easing: L.Motion.Ease.easeInOutQuart
}, {
	removeOnEnd: true,
	showMarker: true,
	icon: L.divIcon({html: "<i class='fa fa-car fa-2x' aria-hidden='true'></i>", iconSize: L.point(27.5, 24)})
}).addTo(map);

Public methods

L.motion.*

Public methods in all motion objects:

motionStart() // to start motion.
motionStop() // to stop motion.
motionPause() // to pause motion.
motionResume() // to resume paused motion.
motionToggle() // to pause motion, if it's running. To start motion if it's not. Or just resume.
getMarkers() // to get multi-dimensional array of markers from all motion sub components.

L.motion.polyline and L.motion.polygon

Additional methods in polyline and polygon

// - expected duration for motion in milliseconds, can be used after motion is created to start animation
// and can be used during animation to change object animation duration.
motionDuration(duration)

// - expected motion speed in KM/H, can be used after motion is created to start animation
// and can be used during animation to change object speed.
motionSpeed(speed)

addLatLng(latLng) // - allows to add additional point in the end for the motion animation.

 // Returns marker (if markerOptions is passed on creation) to attach needed behavior.
 // Marker will be added to the map only during animation
getMarker()

Motion Events

Event Value Description
L.Motion.Event.Started { layer } Fires on motion stated on root element only
L.Motion.Event.Paused { layer } Fires on motion paused on root element only
L.Motion.Event.Resumed { layer } Fires on motion resumed on root element only
L.Motion.Event.Ended { layer } Fires on motion ended on root element only
L.Motion.Event.Section { layer } Fires on each motion section change in L.Motion.Seq starting with first one

Dependencies:

Please include next leaflet modules to make it work properly, or just whole Leaflet.js :)

L.Polygon
L.Polyline
L.FeatureGroup
L.Util
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].