Rotate function programmatically Open layers
TL; DR I want to rotate a feature in my open layers.
I want it to collide with a specific header that I am getting from the server.
I know that you can make the function rotate at a point or so:
window.setInterval(function() {rotateFeature(
pointFeature, 360 / 20, origin)}, 100);
as from the example of open layers.
But I want to be able to look at it towards the title that is given to me, therefore.
- Can I view the function in the header?
- Can I meet a function (image) in the same way?
- If not, is it possible to automatically calculate the required rotation and place it that way?
- Or any ideas on how I can do this with an image? (hoping not to have 360 ββimages).
Thanks in advance.
No luck yet:
window.setInterval(function() {rotateFeature(
imagefeature, 150 / 360, origin)}, 1000);
function rotateFeature(feature, angle, origin) {
feature.geometry.rotate(angle, origin);
}
Where origin is the center of gravity of the image object.
Any piece of code?
a source to share
You can use images / icons to represent vector points eg.
http://openlayers.org/dev/examples/vector-features.html
Uses this png file alt text http://openlayers.org/dev/img/marker.png Then you can rotate point like in another example. You can rotate at any angle:
rotate: function(angle,origin)
Rotate a point around another. Parameters
angle {Float} Angle of rotation in degrees (measured counterclockwise from the positive x-axis)
origin {OpenLayers.Geometry.Point} Center point for rotation
a source to share