antv-l7/examples/gallery/animate/demo/animate_path_texture.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-05-27 19:53:22 +08:00
import { Scene, LineLayer } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
const scene = new Scene({
id: 'map',
map: new GaodeMap({
center: [ 120.19382669582967, 30.258134 ],
2021-05-31 10:34:15 +08:00
pitch: 20,
zoom: 18,
style: 'light'
2021-05-27 19:53:22 +08:00
})
});
scene.on('loaded', () => {
scene.addImage(
'02',
2021-05-27 19:55:06 +08:00
'https://gw.alipayobjects.com/zos/bmw-prod/ce83fc30-701f-415b-9750-4b146f4b3dd6.svg'
2021-05-27 19:53:22 +08:00
);
fetch(
'https://gw.alipayobjects.com/os/basement_prod/40ef2173-df66-4154-a8c0-785e93a5f18e.json'
)
.then(res => res.json())
.then(data => {
const layer = new LineLayer()
.source(data)
.size(4)
.shape('line')
.texture('02')
.color('#25d8b7')
.animate({
interval: 1, // 间隔
duration: 1, // 持续时间,延时
trailLength: 2 // 流线长度
})
.style({
lineTexture: true, // 开启线的贴图功能
iconStep: 20 // 设置贴图纹理的间距
2021-05-27 19:55:06 +08:00
});
2021-05-27 19:53:22 +08:00
scene.addLayer(layer);
});
});