Closed RaminMT closed 3 years ago
Your example not working because you re-create new path feature (linestring) that is not bound to the vector layer on which you run animateFeature. Actually there is no need to re-create it at all, you should use features from the vector source. Check this updated demo https://jsfiddle.net/ghettovoice/jf41enh8/.
As for using image icons, I force icon load with icon.load()
. It seems that without it ol-ext animation don't know icon resolution and can't render it correctly.
Wow! Why it didn't came to my mind?!
Actually here in this line:
let coordinates = this.myFeatures.find(x => x.id === 0).geometry.coordinates
The feature it finds is the line string I'm showing on the map but as I commented It didn't work that way the actual code was like this:
let lineString = this.myFeatures.find(x => x.id === 0)
.
.
.
let animation = new featureAnimationPath({
path: lineString,
rotate: true,
duration: 10 * 1000,
})
And about the icon.load()
thanks! It works!!
Thank you for your efforts dear, your library and replies really helped & saved me
Actually here in this line: let coordinates = this.myFeatures.find(x => x.id === 0).geometry.coordinates The feature it finds is the line string I'm showing on the map but as I commented It didn't work that way the actual code was like this:
Because this.myFeatures
is just a serialized representation of OpenLayers features, not the actual ol/Feature instances that was created inside vector source
Genius! You're right, I got that wrong
And another question, Is it possible to do seeking in the animation?
I don't know. But I found that call vectorLayer.animateFeature(feature, fanim, useFilter)
returns an object with animation control methods. So I think you can stop current animation (this will drop current animating marker) and re-call animation method with a marker on another coordinate along a linestring
https://viglino.github.io/ol-ext/doc/doc-pages/ol.layer.Base.html
Thank you, I've been away for a while I had some investigations and the way is using another lib named ol-games, that supports pause & resume actions
Hi, I tried to use ol-ext library to animate a feature, I set everything up but it's not work, it says animation is playing but I can't see anything on map This is my code:
and the js:
The style I set on animating feature is what they used on ol-ext example, a triangle. It's seems we can't use images, curious why?!