I try to make animatable marker (pulse animation) in flutter app with google_maps_flutter
plugin. Because the only way to create custom markers for now is via marker.icon = BitmapDescription
So I edit plugin source code. Its possible to add own UIView
and it works properly. But when I add any kind of animation then that view appear on the map in its final state with no any animations.
For example in file GoogleMapMarkerController.m,
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(200, 200, 100, 100)];
myView.backgroundColor = [UIColor redColor];
myView.layer.cornerRadius = 50;
CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAnimation.duration = 1.5;
scaleAnimation.repeatCount = HUGE_VAL;
scaleAnimation.autoreverses = YES;
scaleAnimation.fromValue = [NSNumber numberWithFloat:0.1];
scaleAnimation.toValue = [NSNumber numberWithFloat:1.2];
[myView.layer addAnimation:scaleAnimation forKey:@"scale"];
[UIView animateWithDuration:100.0 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
myView.backgroundColor = [UIColor greenColor];
} completion:^(BOOL finished) {
//code for completion
}];
_marker.iconView = myView;
Result
I guess the same will be with Android either.
So how can fix this behavior?