我尝试使用google_maps_flutter
插件在颤振应用程序中制作可动画标记(脉冲动画)。因为目前创建自定义标记的唯一方法是通过marker.icon = BitmapDescription
所以我编辑插件源代码。它可以添加自己的UIView
,它可以正常工作。但是当我添加任何类型的动画时,该视图会以其最终状态出现在地图上,没有任何动画。
例如在文件中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;
结果
我想Android也一样。
那么如何解决这种行为呢?