1
私は開いているレイヤーを使用しています。4.マーカーアニメーションを移動していて、問題なしでthisの例として停止しています。しかし、私は一時停止を追加し、マーカーにも機能を継続したいと思います。いくつかの変数を編集し、これらの関数の問題に取り組んでいます。最初にcontinueAnimation
関数を呼び出すと、elapsedTime
パラメータは負になり、moveFeature
関数で例外が発生します。私が第二にcontinueAnimation
関数を呼び出すとき。期待どおりに動作しています。これは、JavaScriptの実装の問題のようなものです。手伝ってくれてありがとう!Openlayers 4アニメーションを追加する機能を一時停止/続行しますか?
function pauseAnimation() {
animating = false;
//I hold elapsed time globally
var index = Math.round($("[id='rightfrm:tbv1:txt1']").val() * elapsedTime/1000);
(geoMarker.getGeometry()).setCoordinates(line_coordinates[index].lc);
map.un('postcompose', moveFeature);
}
function continueAnimation() {
animating = true;
now = new Date().getTime();
now = now - 10000 + elapsedTime; // --10000-- for negativeness
geoMarker.setStyle(null);
map.on('postcompose', moveFeature);
map.render();
}
私は同じ機能を使用しています。アニメーションの速度に基づいて、フィーチャポイントはスピードまたは速く移動する必要があります。 replayIndex = Math.round(speed * elapsedTime/1000); –
インデックス変数globalを保持しますか? @VenkataBhagyaTejaMaridu – mismanc