【发布时间】:2020-09-28 06:51:03
【问题描述】:
我尝试使用 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 也一样。
那么如何解决这个问题呢?
【问题讨论】:
标签: objective-c google-maps flutter flutter-plugin google-maps-flutter