correct the position/speed when exiting sliders
This commit is contained in:
parent
79f0cead0c
commit
041e0dd439
|
@ -40,6 +40,8 @@ import yugecin.opsudance.movers.slidermovers.InheritedSliderMoverController;
|
|||
import yugecin.opsudance.movers.slidermovers.SliderMoverController;
|
||||
import yugecin.opsudance.spinners.*;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class Dancer {
|
||||
|
||||
public static MoverFactory[] moverFactories = new MoverFactory[] {
|
||||
|
@ -219,6 +221,16 @@ public class Dancer {
|
|||
c.start = new Vec2f((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]);
|
||||
}
|
||||
|
||||
// specific mover stuff
|
||||
if (p.isSlider() && sliderMoverController instanceof DefaultSliderMoverController) {
|
||||
Vec2f st = p.getPointAt(p.getEndTime() - 10);
|
||||
Vec2f en = p.getPointAt(p.getEndTime());
|
||||
//double atan = Math.atan2(en.y - st.y, en.x - st.x);
|
||||
double distance = Utils.distance(st.x, st.y, en.x, en.y);
|
||||
QuadraticBezierMover.p = new Point((int) st.x, (int) st.y);
|
||||
QuadraticBezierMover.setPrevspeed(distance, 10);
|
||||
}
|
||||
|
||||
createNewMover();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.awt.*;
|
|||
public class QuadraticBezierMover extends Mover {
|
||||
|
||||
public static int aggressiveness = 50;
|
||||
private static Point p;
|
||||
public static Point p;
|
||||
private static double prevspeed;
|
||||
|
||||
public static void reset() {
|
||||
|
@ -33,6 +33,10 @@ public class QuadraticBezierMover extends Mover {
|
|||
prevspeed = 0;
|
||||
}
|
||||
|
||||
public static void setPrevspeed(double distance, int timedelta) {
|
||||
prevspeed = distance * aggressiveness / timedelta;
|
||||
}
|
||||
|
||||
private int startTime;
|
||||
private int totalTime;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user