-
Notifications
You must be signed in to change notification settings - Fork 42
Add: animate marker #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Check @IT-MikeS @ItsChaceD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds the ability to animate markers on Google Maps by smoothly transitioning them from one position to another. The animation functionality is implemented across all supported platforms (web, iOS, and Android) with configurable duration.
Key changes:
- Adds
animateMarker
method to the public API interface - Implements platform-specific animation logic using native animation frameworks
- Updates documentation to include the new method
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
plugin/src/web.ts | Implements web animation using requestAnimationFrame with linear interpolation |
plugin/src/map.ts | Adds public API method for marker animation |
plugin/src/implementation.ts | Defines plugin interface and argument types for animation |
plugin/src/definitions.ts | Defines TypeScript interface for animation options |
plugin/ios/Plugin/Map.swift | Implements iOS animation using Core Animation transactions |
plugin/ios/Plugin/CapacitorGoogleMapsPlugin.swift | Adds iOS plugin method handler for marker animation |
plugin/ios/Plugin/CapacitorGoogleMapsPlugin.m | Registers the new plugin method in Objective-C |
plugin/android/src/main/java/com/capacitorjs/plugins/googlemaps/CapacitorGoogleMapsPlugin.kt | Adds Android plugin method handler |
plugin/android/src/main/java/com/capacitorjs/plugins/googlemaps/CapacitorGoogleMap.kt | Implements Android animation using ValueAnimator |
plugin/README.md | Updates documentation with new method details |
README.md | Updates root documentation with new method details |
): Promise<void>; | ||
disableClustering(): Promise<void>; | ||
addMarker(marker: Marker): Promise<string>; | ||
animateMarker(markerId: string,lat: number,lng: number,duration?: number): Promise<void>; |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing spaces after commas in the parameter list. Should be 'markerId: string, lat: number, lng: number, duration?: number'.
animateMarker(markerId: string,lat: number,lng: number,duration?: number): Promise<void>; | |
animateMarker(markerId: string, lat: number, lng: number, duration?: number): Promise<void>; |
Copilot uses AI. Check for mistakes.
enableTouch(args: { id: string }): Promise<void>; | ||
disableTouch(args: { id: string }): Promise<void>; | ||
addMarker(args: AddMarkerArgs): Promise<{ id: string }>; | ||
animateMarker(options: AnimateMarkerOptions): Promise<void>; |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface method uses 'AnimateMarkerOptions' but the implementation uses 'AnimateMarkerArgs'. This inconsistency could cause confusion and type mismatches.
animateMarker(options: AnimateMarkerOptions): Promise<void>; | |
animateMarker(options: AnimateMarkerArgs): Promise<void>; |
Copilot uses AI. Check for mistakes.
return markerHash | ||
} | ||
|
||
func animateMarker( markerId: Int, to target: LatLng, duration: Double) throws { |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space after opening parenthesis. Should be 'func animateMarker(markerId: Int, to target: LatLng, duration: Double) throws {'.
func animateMarker( markerId: Int, to target: LatLng, duration: Double) throws { | |
func animateMarker(markerId: Int, to target: LatLng, duration: Double) throws { |
Copilot uses AI. Check for mistakes.
} | ||
} | ||
|
||
fun animateMarker(markerId: String,lat: Double,lng: Double,duration: Long, callback: (Result<Unit>) -> Unit |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing spaces after commas in the parameter list. Should have spaces after 'String,', 'Double,', 'Double,', and 'Long,'.
fun animateMarker(markerId: String,lat: Double,lng: Double,duration: Long, callback: (Result<Unit>) -> Unit | |
fun animateMarker(markerId: String, lat: Double, lng: Double, duration: Long, callback: (Result<Unit>) -> Unit |
Copilot uses AI. Check for mistakes.
val fraction = anim.animatedValue as Float | ||
val newLat = startPos.latitude + | ||
fraction * (endPos.latitude - startPos.latitude) | ||
val newLng = startPos.longitude + | ||
fraction * (endPos.longitude - startPos.longitude) | ||
marker.position = LatLng(newLat, newLng) | ||
} | ||
addListener(object : AnimatorListenerAdapter() { | ||
override fun onAnimationEnd(animation: Animator) { | ||
callback(Result.success(Unit)) | ||
} |
Copilot
AI
Jul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is inconsistent in the animation block. Lines should be properly aligned within the ValueAnimator block.
val fraction = anim.animatedValue as Float | |
val newLat = startPos.latitude + | |
fraction * (endPos.latitude - startPos.latitude) | |
val newLng = startPos.longitude + | |
fraction * (endPos.longitude - startPos.longitude) | |
marker.position = LatLng(newLat, newLng) | |
} | |
addListener(object : AnimatorListenerAdapter() { | |
override fun onAnimationEnd(animation: Animator) { | |
callback(Result.success(Unit)) | |
} | |
val fraction = anim.animatedValue as Float | |
val newLat = startPos.latitude + | |
fraction * (endPos.latitude - startPos.latitude) | |
val newLng = startPos.longitude + | |
fraction * (endPos.longitude - startPos.longitude) | |
marker.position = LatLng(newLat, newLng) | |
} | |
addListener(object : AnimatorListenerAdapter() { | |
override fun onAnimationEnd(animation: Animator) { | |
callback(Result.success(Unit)) | |
} |
Copilot uses AI. Check for mistakes.
Added the ability to animate the marker to move it from one place to another.