phetsims / curve-fitting

"Curve Fitting" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 3 forks source link

problems with animation of points #90

Closed pixelzoom closed 5 years ago

pixelzoom commented 8 years ago

(1) Animation speed of a point (when it is returned to bucket) does not consider the distance of the point from the bucket. So a point released from the rightmost side of the screen moves slower than a point released near the bucket.

(2) The animation speed is generally too fast. It's almost impossible to see any animation for points released near the bucket.

(3) It appears that points are still pickable while animating, and could potentially be grabbed by someone with cat-like reflexes (thinking @phet-steele here :) And I don't see any code that handles such a situations, or cancels an animation that's in progress.

SaurabhTotey commented 5 years ago

In regards to (1), I don't quite understand the problem: should a point's speed scale with its distance from the bucket, or should it have a constant speed? For (3), would the optimal solution be to have the animation cancel when the point is picked, or should the point become unpickable once it starts animating towards the bucket?

pixelzoom commented 5 years ago

Re (1)... I believe that the speed should be the same, regardless of where the particle is released. But you should confirm with the sim's lead designer. (I'm not sure who that is, if you don't know then ask @ariel-phet.)

Re (3) ... Again, probably best to ask the lead designer. If it were me, I'd cancel the animation if a point is grabbed while it's animating. The other approach seems more likely to accidentally result in points that have pickable:false set forever.

SaurabhTotey commented 5 years ago

A lot of these issues can probably also be addressed at the same time as #112.

SaurabhTotey commented 5 years ago

Ok, assigning to @amanda-phet to get answers about point animation speed for (1) and (2), and also on point behaviour for (3).

amanda-phet commented 5 years ago

For (1) I think a set speed makes sense. In a sim like LSR it's much slower, although it speeds up a little in the middle of the journey. To keep it simple I think a set speed is fine.

(2) I'm happy to iterate on speeds if you like, but start with something and I can let you know if I think it should be faster or slower.

(3) What is done in LSR? @phet-steele tested that one and it passed, so I'd see what was done there in terms of points being pickable while animating.

veillette commented 5 years ago

Regarding point (3). LSR has some logic to deal with points that are grabbed while in motion. However I think the only reason that it is included at the time was to win the accolades of @phet-steele rather than a design decision. However, it is not particularly difficult to implement if you decide to do so.

SaurabhTotey commented 5 years ago

In my latest commit, I ensured that animating points could be grabbed and have the animation cancelled. I also switched the easing to linear. I believe the easing for linear regression is cubic in-out, which is an easy switch to make. As for the current speed of points, I have set it to be an arbitrary 75 model units per second in CurveFittingConstants at line 22.

As such, (3) has been solved (to my knowledge). For (1), the easing is linear, so the speed is always constant. This does mean, however, that the further a point is from the bucket, the longer it will take to arrive. As for (2), I have set the speed to 75 model units per second. I am now assigning this issue to @amanda-phet to review and give feedback.

Also, if it is necessary, I would be able to set up a temporary query parameter that allows adjustments to the speed of the animating points for easier testing.

amanda-phet commented 5 years ago

I think the speed could be a touch slower. Maybe 65 or 70 units per second? Otherwise it all looks good to me. I like linear for this sim. LSR we chose something "fancier" because there is an erase button that returns all points to the bucket, but this sim only animates a point back if it's released outside the grid area.

SaurabhTotey commented 5 years ago

Ok, that makes sense as to why linear should be fine for this simulation. As for the animation speed, I have reduced it now to 65.

amanda-phet commented 5 years ago

Looks great to me! Thanks!