@Override public Long getAnimationLength(){ long time = myAnimationMap.getEndTime() - myAnimationMap.getStartTime(); return time; }
private boolean isComplete(long currentTime){ for(Entry<Integer,CompiledPath> e : myAnimationMap.entrySet()){ CompiledPath path = e.getValue(); if(currentTime < path.getEndTime()){ return false; } } return true; }
public Long getCurrentTime(long time){ Long l = getElapsedPlayTime(time) + myRampTimeMillisec; if(l == null){ return null; } Long s = myAnimationMap.getStartTime(); if(s == null){ return l; } return l+s; }
private void addRamping(Map<Integer,Double> curPos){ myRampedAnimationMap = (CompiledMap)myAnimationMap.clone(); double maxDif = findMaxDif(curPos); maxDif = Utils.bound(maxDif, 0.0, 1.0); myRampTimeMillisec = (int)(maxDif*myMaxRampTimeMillisec); InterpolatorFactory linearFact = new LinearInterpolatorFactory(); for(Entry<Integer,CompiledPath> e : myRampedAnimationMap.entrySet()){ CompiledPath path = e.getValue(); int id = e.getKey(); CompiledPath ramp = rampPath.compilePath( 0, myRampTimeMillisec, myStepLengthMillisec); path.addAll(0, ramp); myRampedAnimationMap.setTimes( myRampedAnimationMap.getStartTime(), myRampedAnimationMap.getEndTime()+myRampTimeMillisec, true);
myPreviousPositions.clear(); long cur = getCurrentTime(time); for(Entry<Integer,CompiledPath> e : myAnimationMap.entrySet()){ CompiledPath path = e.getValue(); Integer id = e.getKey(); double pos = path.estimatePosition(cur); if(id == null || !NormalizedDouble.isValid(pos)){ continue; myPreviousPositions.clear(); cur = getCurrentTime(time+interval); for(Entry<Integer,CompiledPath> e : myAnimationMap.entrySet()){ CompiledPath path = e.getValue(); Integer id = e.getKey(); double pos = path.estimatePosition(cur); if(id == null || !NormalizedDouble.isValid(pos)){ continue;
continue; CompiledPath path = myAnimationMap.get(c.getId()); if(path == null){ continue; double v = path.estimatePosition(0); if(id == null || !NormalizedDouble.isValid(v)){ continue;
private double findMaxDif(Map<Integer,Double> currentPos){ double maxDif = 0; for(Entry<Integer,CompiledPath> e : myAnimationMap.entrySet()){ CompiledPath path = e.getValue(); int id = e.getKey(); double start = getStart(path); if(start == -1){ continue; } Double cur = currentPos.get(id); if(cur == null){ continue; } double dif = Math.abs(cur - start); if(dif > maxDif){ maxDif = dif; } } return maxDif; }
@Override public Long getAnimationLength(){ return myAnimationMap.getEndTime() - myAnimationMap.getStartTime(); }
private boolean isComplete(long currentTime){ for(Entry<Integer,CompiledPath> e : myAnimationMap.entrySet()){ CompiledPath path = e.getValue(); if(currentTime < path.getEndTime()){ return false; } } return true; }
myPreviousPositions.clear(); long cur = getCurrentTime(time); for(Entry<Integer,CompiledPath> e : myRampedAnimationMap.entrySet()){ CompiledPath path = e.getValue(); Integer id = e.getKey(); double pos = path.estimatePosition(cur); if(id == null || !NormalizedDouble.isValid(pos)){ continue; myPreviousPositions.clear(); long next = getCurrentTime(time+interval); for(Entry<Integer,CompiledPath> e : myRampedAnimationMap.entrySet()){ CompiledPath path = e.getValue(); Integer id = e.getKey(); double pos = path.estimatePosition(next); if(id == null || !NormalizedDouble.isValid(pos)){ continue;
public Long getCurrentTime(long time){ Long l = getElapsedPlayTime(time); if(l == null){ return null; } Long s = myAnimationMap.getStartTime(); if(s == null){ return l; } return l+s; }
listener.animationStart(myRampedAnimationMap.getStartTime(), myRampedAnimationMap.getEndTime());
listener.animationStart(myAnimationMap.getStartTime(), myAnimationMap.getEndTime());