Skip to content
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

Custom animations (scale, rotate, translate) do not work? #33

Open
hiasel opened this issue Jun 18, 2019 · 0 comments
Open

Custom animations (scale, rotate, translate) do not work? #33

hiasel opened this issue Jun 18, 2019 · 0 comments

Comments

@hiasel
Copy link

hiasel commented Jun 18, 2019

I would like to add a custom animation when markers are attached to the adapter. Following the provided sample code from the README, the alpha animation works perfectly on my created markers (https://github.com/TradeMe/MapMe#animations):

override fun onAnnotationAdded(annotation: MapAnnotation) {
        if (annotation !is MarkerAnnotation) return

        ObjectAnimator.ofFloat(annotation, "alpha", 0f, 1f)
                .apply {
                    duration = 150
                    interpolator = DecelerateInterpolator()
                    start()
               }
}

However, when I try to implement a different animation, it doesn't seem to work, i.e. the markers simply pop up without any animation?
I've tried translation, rotationand scale as follows:

ObjectAnimator.ofFloat(annotation, "translationX", 100f).apply {
    duration = 1000
    start()
}
ObjectAnimator.ofFloat(annotation, "rotation", 360f).apply {
    duration = 1000
    start()
}
ObjectAnimator.ofFloat(annotation, "scaleX", 2f).apply {
    duration = 1000
    start()
}

Am I doing something wrong or is alpha the only supported animation on markers?
Btw.: I am using the default google maps marker icon, i.e.:

factory.createMarker(LatLng(item.lat, item.lon), null, item.title)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant