/** * @param time Set the time of the currently playing animation, the time * is clamped from 0 to {@link #getAnimMaxTime()}. */ public void setTime(float time) { this.time = FastMath.clamp(time, 0, getAnimMaxTime()); }
t = t % channel.getAnimMaxTime(); float parity = (float) Math.ceil(time / channel.getAnimMaxTime()); if (parity > 0 && parity % 2 == 0) { t = channel.getAnimMaxTime() - t % channel.getAnimMaxTime(); } else { t = t % channel.getAnimMaxTime(); channel.reset(true); if (t > channel.getAnimMaxTime()) { channel.setTime(t); channel.getControl().update(0);
/** * @param time Set the time of the currently playing animation, the time * is clamped from 0 to {@link #getAnimMaxTime()}. */ public void setTime(float time) { this.time = FastMath.clamp(time, 0, getAnimMaxTime()); }
/** * @param time Set the time of the currently playing animation, the time * is clamped from 0 to {@link #getAnimMaxTime()}. */ public void setTime(float time) { this.time = FastMath.clamp(time, 0, getAnimMaxTime()); }
t = t % channel.getAnimMaxTime(); float parity = (float) Math.ceil(time / channel.getAnimMaxTime()); if (parity > 0 && parity % 2 == 0) { t = channel.getAnimMaxTime() - t % channel.getAnimMaxTime(); } else { t = t % channel.getAnimMaxTime(); channel.reset(true); if (t > channel.getAnimMaxTime()) { channel.setTime(t); channel.getControl().update(0);
@Override public void visit(Spatial spatial) { AnimControl animControl = spatial.getControl(AnimControl.class); if (animControl != null) { AnimChannel channel = animControl.createChannel(); channel.setAnim("anim"); channel.setLoopMode(LoopMode.Loop); if (randomizeAnimation) { channel.setSpeed(FastMath.nextRandomInt(6, 10) / 10f); channel.setTime(FastMath.nextRandomFloat() * channel.getAnimMaxTime()); } // Don't batch animated objects, seems not to work object.setBatchHint(Spatial.BatchHint.Never); } } });