- Added TrackPoint with time added and expiry to calculate opacity each frame - Modified drawTrackPoint to compute colour from TrackPoint alpha - Removed getTrackPoint from BoatInRace #pait[jjg64, cbt24]main
parent
63591ad1ec
commit
375202e7a0
@ -0,0 +1,26 @@
|
|||||||
|
package seng302.Model;
|
||||||
|
|
||||||
|
import seng302.GPSCoordinate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cbt24 on 7/04/17.
|
||||||
|
*/
|
||||||
|
public class TrackPoint {
|
||||||
|
private GPSCoordinate coordinate;
|
||||||
|
private long timeAdded;
|
||||||
|
private long expiry;
|
||||||
|
|
||||||
|
public TrackPoint(GPSCoordinate coordinate, long timeAdded, long expiry) {
|
||||||
|
this.coordinate = coordinate;
|
||||||
|
this.timeAdded = timeAdded;
|
||||||
|
this.expiry = expiry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GPSCoordinate getCoordinate() {
|
||||||
|
return coordinate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getAlpha() {
|
||||||
|
return Double.max(0,1.0 - (double)(System.currentTimeMillis() - timeAdded)/expiry);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue