mapCtx.translateMarker({
markerId: 0,
rotate:Math.abs(newValue[0].rotate),
// autoRotate:true,
duration: 2000,
destination: {
latitude: newValue[0].latitude,
longitude: newValue[0].longitude
},
animationEnd: () => {
console.log("小车行驶动画执行完毕!")
}
})

- 发布:2022-12-03 18:52
- 更新:2022-12-06 21:30
- 阅读:331
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 64
HBuilderX类型: 正式
HBuilderX版本号: 3.6.5
第三方开发者工具版本号: 微信开发者工具版本 1.05
基础库版本号: 1.05
项目创建方式: HBuilderX
示例代码:
操作步骤:
mapCtx.translateMarker({
markerId: 0,
rotate:Math.abs(newValue[0].rotate),//90度
// autoRotate:true,
duration: 2000,
destination: {
latitude: newValue[0].latitude,
longitude: newValue[0].longitude
},
animationEnd: () => {
console.log("小车行驶动画执行完毕!")
}
})
mapCtx.translateMarker({
markerId: 0,
rotate:Math.abs(newValue[0].rotate),//90度
// autoRotate:true,
duration: 2000,
destination: {
latitude: newValue[0].latitude,
longitude: newValue[0].longitude
},
animationEnd: () => {
console.log("小车行驶动画执行完毕!")
}
})
预期结果:
mapCtx.translateMarker({
markerId: 0,
rotate:Math.abs(newValue[0].rotate),//90度
// autoRotate:true,
duration: 2000,
destination: {
latitude: newValue[0].latitude,
longitude: newValue[0].longitude
},
animationEnd: () => {
console.log("小车行驶动画执行完毕!")
}
})
mapCtx.translateMarker({
markerId: 0,
rotate:Math.abs(newValue[0].rotate),//90度
// autoRotate:true,
duration: 2000,
destination: {
latitude: newValue[0].latitude,
longitude: newValue[0].longitude
},
animationEnd: () => {
console.log("小车行驶动画执行完毕!")
}
})
实际结果:
mapCtx.translateMarker({
markerId: 0,
rotate:Math.abs(newValue[0].rotate),//180度
// autoRotate:true,
duration: 2000,
destination: {
latitude: newValue[0].latitude,
longitude: newValue[0].longitude
},
animationEnd: () => {
console.log("小车行驶动画执行完毕!")
}
})
mapCtx.translateMarker({
markerId: 0,
rotate:Math.abs(newValue[0].rotate),//180度
// autoRotate:true,
duration: 2000,
destination: {
latitude: newValue[0].latitude,
longitude: newValue[0].longitude
},
animationEnd: () => {
console.log("小车行驶动画执行完毕!")
}
})

直接使用微信小程序(不使用 uni-app )测试一下,如果仍然有问题,反馈到微信小程序社区
【咨询问题/bug处理优先级规则】:https://ask.dcloud.net.cn/article/38139
1***@qq.com (作者)
需要一起使用角度才会对,但是还是会出现突然角度不对的情况,这边已经打算不使用这种角度图标了,rotate:Math.abs(newValue[0].rotate),//180度
autoRotate:true,
2022-12-07 13:55
DCloud_UNI_Anne
回复 1***@qq.com: 两项都必填详见
2022-12-07 17:14
1***@qq.com (作者)
回复 DCloud_UNI_Anne: 下次要结合WX文档一起看了!
2022-12-07 18:13