MCPcopy
hub / github.com/ampproject/amphtml / stepContinue_

Method stepContinue_

src/motion.js:216–234  ·  view source on GitHub ↗

* Returns "true" to continue and "false" to stop motion process. * @param {time} timeSinceStart * @param {time} timeSincePrev * @return {boolean} * @private

(timeSinceStart, timeSincePrev)

Source from the content-addressed store, hash-verified

214 * @private
215 */
216 stepContinue_(timeSinceStart, timeSincePrev) {
217 if (!this.continuing_) {
218 return false;
219 }
220
221 this.lastX_ += timeSincePrev * this.velocityX_;
222 this.lastY_ += timeSincePrev * this.velocityY_;
223 if (!this.fireMove_()) {
224 return false;
225 }
226
227 const decel = Math.exp(-timeSinceStart / EXP_FRAME_CONST_);
228 this.velocityX_ = this.maxVelocityX_ * decel;
229 this.velocityY_ = this.maxVelocityY_ * decel;
230 return (
231 Math.abs(this.velocityX_) > MIN_VELOCITY_ ||
232 Math.abs(this.velocityY_) > MIN_VELOCITY_
233 );
234 }
235
236 /**
237 * @param {boolean} success

Callers

nothing calls this directly

Calls 1

fireMove_Method · 0.95

Tested by

no test coverage detected