Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(isFlying
? isSpectator
? SPECTATOR_INERTIA
: INERTIA
: (isOnGround ? FRIC_INERTIA : IN_AIR_INERTIA) /
(isSprinting ? SPRINT_FACTOR : 1)) *
delta
if (this.needsToJump) {
this.jumping = true
this.currJumpTime = JUMP_TIME
this.needsToJump = false
}
if (this.currJumpTime > 0 && this.jumping) {
const jf = easeQuadOut(this.currJumpTime / JUMP_TIME) * JUMP_FORCE
this.acc.y += jf // !?????
this.currJumpTime -= delta * 1000
}
if (this.currJumpTime <= 0) {
this.jumping = false
this.currJumpTime = 0
}
this.vel.add(this.acc)
this.acc.set(0.0, 0.0, 0.0)
if (shouldGravity && !this.freshlyJumped) this.vel.y += GRAVITY
this.vel.multiplyScalar(delta)
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
*/
import * as d3Ease from 'd3-ease';
let t_in: number = 0.5;
let t_out: number;
t_out = d3Ease.easeLinear(t_in);
t_out = d3Ease.easeQuad(t_in);
t_out = d3Ease.easeQuadIn(t_in);
t_out = d3Ease.easeQuadOut(t_in);
t_out = d3Ease.easeQuadInOut(t_in);
t_out = d3Ease.easeCubic(t_in);
t_out = d3Ease.easeCubicIn(t_in);
t_out = d3Ease.easeCubicOut(t_in);
t_out = d3Ease.easeCubicInOut(t_in);
let easePolyFactory: d3Ease.PolynomialEasingFactory;
easePolyFactory = d3Ease.easePoly;
easePolyFactory = d3Ease.easePoly.exponent(2);
t_out = easePolyFactory(t_in);
easePolyFactory = d3Ease.easePolyIn;
easePolyFactory = d3Ease.easePolyIn.exponent(2);
if (pos >= 0 && pos <= 20) {
let e = easeQuadInOut(pos / 20);
position = [0, e * -5, e * 15 + 5];
rotation = [e * -10, 0, 0];
} else if (pos > 20 && pos <= 40) {
let e = easeQuadInOut((pos - 20) / 20);
position = [0, -5 + e * 5, 15 + 5 - e * 15];
rotation = [-10 + e * -80, 0, 0];
} else if (pos > 40 && pos <= 90) {
let e = (pos - 40) / 50;
position = [0, e * 40, 5];
rotation = [-90, 0, 0];
} else if (pos > 90 && pos <= 100) {
let e = easeQuadOut((pos - 90) / 10);
position = [0, 40 + e * 5, 5];
rotation = [-90, 0, 0];
}
if (scroll >= 0 && scroll < 40) {
if (scrollDirection === 1) {
setScrollSpring({ scrollSpring: scroll -= 0.125 })
} else if (scrollDirection === 0) {
setScrollSpring({ scrollSpring: scroll += 0.125 })
}
}
if (scroll <= 0.1) {
setScrollSpring({ scrollSpring: 0 })
scrollDirection = -1;
}