Skip to content
Snippets Groups Projects
Commit ddfe8dd5 authored by Greg Fodor's avatar Greg Fodor
Browse files

Fix lerping to be smooth after first pass

parent 03844628
No related branches found
No related tags found
No related merge requests found
......@@ -29,12 +29,13 @@ AFRAME.registerComponent("scene-preview-camera", {
this.startTime = new Date().getTime();
this.backwards = false;
this.ranOnePass = false;
},
tick: function() {
let t = (new Date().getTime() - this.startTime) / (1000.0 * this.data.duration);
if (!this.backwards) {
if (!this.ranOnePass) {
t = t * (2 - t);
} else {
t = t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
......@@ -55,6 +56,7 @@ AFRAME.registerComponent("scene-preview-camera", {
}
if (t >= 0.9999) {
this.ranOnePass = true;
this.backwards = !this.backwards;
this.startTime = new Date().getTime();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment