高德自定义镜头动画

主要在定义贝塞尔动画来控制质感,好用的贝塞尔定义网站CSS3贝塞尔曲线工具 - bejson在线工具

效果视频:

QQ2024716-164137-HD

高德地图中需要引用高德的loca插件

代码

const rot = (center, zoom) => {
	const curZoom = map.getZoom();
	const curPitch = map.getPitch();
	const curRotation = map.getRotation();
	const curCenter = [map.getCenter().lng, map.getCenter().lat];

	const targZoom = zoom;
	const targPitch = 40;
	const targRotation = 0;
	const targCenter = center;

	const route = [
		{
			pitch: {
				value: targPitch,
				duration: 9000,
				control: [
					[0, curPitch],
					[1, targPitch],
				],
				timing: [1.0, 0.01, 0.56, 0.995],
			},
			zoom: {
				value: targZoom,
				duration: 10000,
				control: [
					[0, curZoom],
					[1, targZoom],
				],
				timing: [0.52, 0.0, 0.29, 0.99],
			},
			rotation: {
				value: targRotation,
				duration: 7000,
				control: [
					[0, curRotation],
					[1, targRotation],
				],
				timing: [0.55, 0.005, 0.565, 1],
			},
			center: {
				value: targCenter,
				duration: 6000,
				control: [curCenter, targCenter],
				timing: [0.8, 0.85, 0.9, 0.95, 1],
			},
		},
	];

	loca.viewControl.addAnimates(route, () => {
		console.log("初始动画结束,开始调用");
		// 开始自动旋转动画
		// startAutoRotate();
	});
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值