mathisonian / mathisonian/premonish

How to calculate the distance the mouse will move?

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Sorry to bother you, because this is not an issue exactly.

I'm learning from the source code, but I can't understand this sentence:

``` js
let x = position.x + 100 * Math.pow(1 + velocity.x, 2) * sign(velocity.x);
```

I think `100 * (1+velocity.x)^2` mey be a formula to calculate the displacement, but I can't describe where the 100 and 1 come from.

Could you please help me?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the source-code expression containing position, velocity, Math.pow, and sign. Trace where those values and the sign function are defined, then document what the calculation represents and where the constants 100 and 1 come from. Done means the formula's intent and inputs are explained clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.