aurelienribon.tweenengine.Timeline Java Examples

The following examples show how to use aurelienribon.tweenengine.Timeline. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultAnimator.java    From uracer-kotd with Apache License 2.0 6 votes vote down vote up
@Override
public void alertBegins (int milliseconds) {
	if (!alertBegan) {
		alertBegan = true;
		GameTweener.stop(alertAmount);
		Timeline seq = Timeline.createSequence();

		//@off
		seq
			.push(Tween.to(alertAmount, BoxedFloatAccessor.VALUE, milliseconds).target(1.5f).ease(Quad.IN))
			.pushPause(50)
			.push(Tween.to(alertAmount, BoxedFloatAccessor.VALUE, milliseconds).target(0.75f).ease(Quad.OUT))
		;
		GameTweener.start(seq);
		//@on
	}
}
 
Example #2
Source File: DefaultAnimator.java    From uracer-kotd with Apache License 2.0 6 votes vote down vote up
@Override
public void alert (int milliseconds) {
	if (alertBegan) {
		return;
	}

	//@off
	Timeline seq = Timeline.createSequence();
	GameTweener.stop(alertAmount);
	seq
		.push(Tween.to(alertAmount, BoxedFloatAccessor.VALUE, 75).target(0.75f).ease(Quad.IN))
		.pushPause(50)
		.push(Tween.to(alertAmount, BoxedFloatAccessor.VALUE, milliseconds).target(0).ease(Quad.OUT));
	GameTweener.start(seq);
	//@on
}
 
Example #3
Source File: Message.java    From uracer-kotd with Apache License 2.0 6 votes vote down vote up
public void show () {
	completed = false;
	hiding = false;

	setAlpha(0);
	setScale(0, 0);
	showCompleted = false;

	computeFinalPosition();

	SysTweener.stop(this);

	//@off
	SysTweener.start(Timeline.createParallel()
		.push(Tween.to(this, MessageAccessor.OPACITY, 850).target(1f).ease(Expo.INOUT))
		.push(Tween.to(this, MessageAccessor.POSITION_Y, 700).target(finalY).ease(Expo.INOUT))
		.push(Tween.to(this, MessageAccessor.SCALE_XY, 800).target(scale, scale).ease(Back.INOUT)).setCallback(showFinished));
	//@on
}
 
Example #4
Source File: HudLapInfo.java    From uracer-kotd with Apache License 2.0 6 votes vote down vote up
public void toColor (int millisecs, float red, float green, float blue) {
	Timeline seq = Timeline.createParallel();

	GameTweener.stop(r);
	GameTweener.stop(g);
	GameTweener.stop(b);

	//@off
	seq
		.push(Tween.to(r, BoxedFloatAccessor.VALUE, millisecs).target(red).ease(Linear.INOUT))
		.push(Tween.to(g, BoxedFloatAccessor.VALUE, millisecs).target(green).ease(Linear.INOUT))
		.push(Tween.to(b, BoxedFloatAccessor.VALUE, millisecs).target(blue).ease(Linear.INOUT))
	;
	//@on

	GameTweener.start(seq);
}
 
Example #5
Source File: CarHighlighter.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public void untrack (boolean force) {
	if (!isTracking) return;

	// do busy wait if not forcing
	if (!force && isBusy) return;

	isBusy = true;
	isActive = true;
	isTracking = false;

	bfScale.value = 1f;
	bfAlpha.value = trackAlpha;
	bfRot.value = 0f;

	bfRed.value = 1f;
	bfGreen.value = 1f;
	bfBlue.value = 1f;

	Timeline timeline = Timeline.createParallel();
	float ms = Config.Graphics.DefaultFadeMilliseconds;

	GameTweener.stop(bfAlpha);
	GameTweener.stop(bfScale);
	GameTweener.stop(bfRot);

	//@off
	timeline
		.push(Tween.to(bfScale, BoxedFloatAccessor.VALUE, ms).target(4).ease(Linear.INOUT))
		.push(Tween.to(bfAlpha, BoxedFloatAccessor.VALUE, ms).target(0).ease(Linear.INOUT))
		.push(Tween.to(bfRot, BoxedFloatAccessor.VALUE, ms).target(-90).ease(Linear.INOUT))
		.setCallback(busyCallback)
		;
	//@on

	GameTweener.start(timeline);
}
 
Example #6
Source File: BaseLogic.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
@Override
public void collision (CarEvent.Data data) {
	// stops time dilation
	// if (gameInput.isTimeDilating()) {
	// endTimeDilation();
	// }

	float clampedImpactForce = AMath.normalizeImpactForce(data.impulses.len());

	// while busy, a new collision factor will be accepted *only* if stronger than the previous one
	if (clampedImpactForce > 0 && clampedImpactForce > lastImpactForce) {
		lastImpactForce = clampedImpactForce;

		GameTweener.stop(collisionFactor);
		collisionFrontRatio = data.frontRatio;
		collisionFactor.value = 0;

		final float min = GameplaySettings.CollisionFactorMinDurationMs;
		final float max = GameplaySettings.CollisionFactorMaxDurationMs;

		//@off
		GameTweener.start(Timeline
			.createSequence()
			.push(Tween.to(collisionFactor, BoxedFloatAccessor.VALUE,100).target(clampedImpactForce).ease(Linear.INOUT))
			.push(Tween.to(collisionFactor, BoxedFloatAccessor.VALUE,min + max * clampedImpactForce).target(0)
				.ease(Linear.INOUT)).setCallback(collisionFinished));
		//@on

		playerTasks.hudPlayer.highlightCollision();
	}
}
 
Example #7
Source File: BaseLogic.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
@Override
public void endCollisionTime () {
	GameTweener.stop(collisionFactor);
	collisionFrontRatio = 0.5f;
	lastImpactForce = 0;

	if (!AMath.isZero(collisionFactor.value)) {
		//@off
		GameTweener.start(Timeline
			.createSequence()
			.push(Tween.to(collisionFactor, BoxedFloatAccessor.VALUE, 500).target(0).ease(Linear.INOUT)));
		//@on
	}
}
 
Example #8
Source File: Message.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public void hide () {
	if (!hiding) {
		hiding = true;

		SysTweener.stop(this);

		//@off
		SysTweener.start(Timeline.createParallel()
			.push(Tween.to(this, MessageAccessor.OPACITY, 600).target(0f).ease(Expo.INOUT))
			.push(Tween.to(this, MessageAccessor.POSITION_Y, 700).target(startY).ease(Expo.INOUT))
			.push(Tween.to(this, MessageAccessor.SCALE_XY, 800).target(0, 0).ease(Back.INOUT)).setCallback(hideFinished));
		//@on
	}
}
 
Example #9
Source File: HudLabel.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public void slide (boolean slideUp) {
	setScale(1);

	position.y += 50;
	float targetNearX = position.x;
	float targetNearY = position.y;
	float targetFarX = position.x;
	float targetFarY = position.y - 100;
	if (!slideUp) {
		targetFarY = position.y + 100;
	}

	GameTweener
		.start(Timeline
			.createParallel()
			.push(Tween.to(this, HudLabelAccessor.OPACITY, 500).target(1f).ease(Quint.INOUT))
			.push(
				Timeline
					.createSequence()
					.push(
						Tween.to(this, HudLabelAccessor.POSITION_XY, 500).target(targetNearX, targetNearY).ease(Quint.INOUT)
							.delay(300))
					.push(
						Timeline.createParallel()
							.push(Tween.to(this, HudLabelAccessor.POSITION_XY, 500).target(targetFarX, targetFarY).ease(Expo.OUT))
							.push(Tween.to(this, HudLabelAccessor.OPACITY, 500).target(0f).ease(Expo.OUT)))));
}
 
Example #10
Source File: HudLabel.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
/** effects */

	public void fadeIn (int milliseconds) {
		GameTweener.stop(this);
		GameTweener.start(Timeline.createSequence().push(
			Tween.to(this, HudLabelAccessor.OPACITY, milliseconds).target(1f).ease(Linear.INOUT)));
		// Gdx.app.log("", "fadein");
	}
 
Example #11
Source File: WrongWay.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public void fadeOut (int millisecs) {
	if (isShown) {
		isShown = false;
		GameTweener.stop(bfAlpha);
		Timeline seq = Timeline.createSequence();
		seq.push(Tween.to(bfAlpha, BoxedFloatAccessor.VALUE, millisecs).target(0f).ease(Linear.INOUT));
		GameTweener.start(seq);
	}
}
 
Example #12
Source File: WrongWay.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public void fadeIn (int millisecs) {
	if (!isShown) {
		isShown = true;
		GameTweener.stop(bfAlpha);
		Timeline seq = Timeline.createSequence();
		seq.push(Tween.to(bfAlpha, BoxedFloatAccessor.VALUE, millisecs).target(1f).ease(Linear.INOUT));
		GameTweener.start(seq);
	}
}
 
Example #13
Source File: CarHighlighter.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public void track (boolean force, float alpha) {
	if (isTracking) return;

	// do busy wait if not forcing
	if (!force && isBusy) return;

	isBusy = true;
	isActive = true;
	isTracking = true;

	trackAlpha = alpha;

	bfScale.value = 4f;
	bfAlpha.value = 0f;
	bfRot.value = -90f;

	bfRed.value = 1f;
	bfGreen.value = 1f;
	bfBlue.value = 1f;

	Timeline timeline = Timeline.createParallel();
	float ms = Config.Graphics.DefaultFadeMilliseconds;

	GameTweener.stop(bfAlpha);
	GameTweener.stop(bfScale);
	GameTweener.stop(bfRot);

	//@off
	timeline
		.push(Tween.to(bfScale, BoxedFloatAccessor.VALUE, ms).target(1f).ease(Linear.INOUT))
		.push(Tween.to(bfAlpha, BoxedFloatAccessor.VALUE, ms).target(alpha).ease(Linear.INOUT))
		.push(Tween.to(bfRot, BoxedFloatAccessor.VALUE, ms).target(0f).ease(Linear.INOUT))
		.setCallback(busyCallback)
	;
	//@on

	GameTweener.start(timeline);
}
 
Example #14
Source File: CarHighlighter.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public void error (int blinkCount) {
	if (isBusy) {
		return;
	}

	isBusy = true;
	isActive = true;

	bfScale.value = 1f;
	bfRot.value = 0f;
	bfAlpha.value = 0f;

	bfRed.value = 1f;
	bfGreen.value = 0.1f;
	bfBlue.value = 0f;

	GameTweener.stop(bfAlpha);

	Timeline seq = Timeline.createSequence();

	//@off
	seq
		.push(Tween.to(bfAlpha, BoxedFloatAccessor.VALUE, 100).target(1f).ease(Linear.INOUT))
		.push(Tween.to(bfAlpha, BoxedFloatAccessor.VALUE, 100).target(0f).ease(Linear.INOUT))
		.repeat(blinkCount, 0)
		.setCallback(busyCallback)
	;
	//@on

	GameTweener.start(seq);
}
 
Example #15
Source File: CarHighlighter.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public void setCar (Car car) {
	prevState = null;

	if (followedCar != null && followedCar instanceof GhostCar) {
		prevState = renderState;
		((GhostCar)followedCar).tweenAlphaTo(Config.Graphics.DefaultGhostCarOpacity);
	}

	followedCar = car;
	hasCar = followedCar != null;
	renderState = followedCar.state();

	CarModel model = car.getCarModel();
	sprite.setSize(Convert.mt2px(model.width) * 1.4f, Convert.mt2px(model.length) * 1.4f);
	sprite.setOrigin(sprite.getWidth() / 2, sprite.getHeight() / 2);

	offX = sprite.getOriginX();
	offY = sprite.getOriginY();

	if (prevState != null && isTracking) {
		// compute a position factor to later (at render time) interpolate the final position between the two render states
		GameTweener.stop(bfRenderState);

		interpolateState = true;
		bfRenderState.value = 0;
		Timeline timeline = Timeline.createSequence();
		//@off
		timeline.push(Tween.to(bfRenderState, BoxedFloatAccessor.VALUE, Config.Graphics.DefaultGhostOpacityChangeMs).target(1).ease(Config.Graphics.DefaultGhostOpacityChangeEq));
		timeline.setCallback(renderStateCallback);
		//@on

		GameTweener.start(timeline);
	}

	if (followedCar != null && followedCar instanceof GhostCar) {
		((GhostCar)followedCar).tweenAlphaTo(Config.Graphics.DefaultTargetCarOpacity);
	}
}
 
Example #16
Source File: DefaultAnimator.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
@Override
public void gameResume (int milliseconds) {
	if (pauseBegan) {
		pauseBegan = false;

		SysTweener.stop(pauseAmount);
		Timeline seq = Timeline.createSequence();
		seq.push(Tween.to(pauseAmount, BoxedFloatAccessor.VALUE, milliseconds).target(0).ease(Linear.INOUT));
		SysTweener.start(seq);
	}
}
 
Example #17
Source File: DefaultAnimator.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
@Override
public void gamePause (int milliseconds) {
	if (!pauseBegan) {
		pauseBegan = true;
		SysTweener.stop(pauseAmount);
		Timeline seq = Timeline.createSequence();

		//@off
		seq
			.push(Tween.to(pauseAmount, BoxedFloatAccessor.VALUE, milliseconds).target(1f).ease(Linear.INOUT))
		;
		SysTweener.start(seq);
		//@on
	}
}
 
Example #18
Source File: DefaultAnimator.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
@Override
public void alertEnds (int milliseconds) {
	if (alertBegan) {
		alertBegan = false;

		GameTweener.stop(alertAmount);
		Timeline seq = Timeline.createSequence();
		seq.push(Tween.to(alertAmount, BoxedFloatAccessor.VALUE, milliseconds).target(0).ease(Quad.INOUT));
		GameTweener.start(seq);
	}
}
 
Example #19
Source File: GhostCar.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
public void tweenAlphaTo (float value, float ms, TweenEquation eq) {
	GameTweener.stop(bfAlpha);
	Timeline timeline = Timeline.createSequence();
	timeline.push(Tween.to(bfAlpha, BoxedFloatAccessor.VALUE, ms).target(value).ease(eq));
	GameTweener.start(timeline);
}
 
Example #20
Source File: HudLabel.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
public void fadeOut (int milliseconds) {
	GameTweener.stop(this);
	GameTweener.start(Timeline.createSequence().push(
		Tween.to(this, HudLabelAccessor.OPACITY, milliseconds).target(0f).ease(Linear.INOUT)));
	// Gdx.app.log("", "fadeout");
}
 
Example #21
Source File: TimeModulator.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
private void modulateTo (TweenEquation eq, float to, float durationMs) {
	SysTweener.stop(timeMultiplier);
	timeSeq = Timeline.createSequence();
	timeSeq.push(Tween.to(timeMultiplier, BoxedFloatAccessor.VALUE, durationMs).target(to).ease(eq));
	SysTweener.start(timeSeq);
}
 
Example #22
Source File: TimeModulator.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
public TimeModulator () {
	timeMultiplier = new BoxedFloat(1);
	timeSeq = Timeline.createSequence();
}
 
Example #23
Source File: SysTweener.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
public static void start (Timeline timeline) {
	timeline.start(manager);
}
 
Example #24
Source File: GameTweener.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
public static void start (Timeline timeline) {
	timeline.start(manager);
}
 
Example #25
Source File: TimelineApplet.java    From universal-tween-engine with Apache License 2.0 4 votes vote down vote up
public Timeline getTimeline() {
	return timeline;
}