この例の特徴をアニメーション化するpostcomposeとvectorContextを使用する方法を示しています。vectorContext.setStyleのopenlayers3:ol.style.Iconは機能しませんか?
http://openlayers.org/en/latest/examples/feature-animation.html
私はこれらの行にスタイルを交換してみてください。
var style = new ol.style.Style({
image: new ol.style.Circle({
radius: radius,
snapToPixel: false,
stroke: new ol.style.Stroke({
color: 'rgba(255, 0, 0, ' + opacity + ')',
width: 0.25 + opacity
})
})
});
vectorContext.setStyle(style);
私はIMGのスタイルにスタイルを交換するときこのように:
var style = new ol.style.Style({
image: new ol.style.Icon(({
src: 'https://openlayers.org/en/v3.20.1/examples/data/icon.png'
}))
});
エラーがスローされます:プロパティ '0'を読み込めませんnull
バグですか?または、どうすればimgスタイルを使用できますか?
あなたのコードに誤りはありません。すべてが適切に動作するはずです。私たちは何が起こっているかを見ることができるように生きている例を提供できますか? – Icarus
これは一例です:https://jsfiddle.net/codingmiao/9gou6rwL/6/、私は53行目のスタイルを変更します(元の例はhttp://openlayers.org/en/latest/examples/feature- animation.html)、関数 "animate"は機能しません... –