aurelienribon.tweenengine.equations.Quad Java Examples

The following examples show how to use aurelienribon.tweenengine.equations.Quad. 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: TweenUtils.java    From universal-tween-engine with Apache License 2.0 6 votes vote down vote up
/**
 * Takes an easing name and gives you the corresponding TweenEquation.
 * You probably won't need this, but tools will love that.
 *
 * @param easingName The name of an easing, like "Quad.INOUT".
 * @return The parsed equation, or null if there is no match.
 */
public static TweenEquation parseEasing(String easingName) {
	if (easings == null) {
		easings = new TweenEquation[] {Linear.INOUT,
			Quad.IN, Quad.OUT, Quad.INOUT,
			Cubic.IN, Cubic.OUT, Cubic.INOUT,
			Quart.IN, Quart.OUT, Quart.INOUT,
			Quint.IN, Quint.OUT, Quint.INOUT,
			Circ.IN, Circ.OUT, Circ.INOUT,
			Sine.IN, Sine.OUT, Sine.INOUT,
			Expo.IN, Expo.OUT, Expo.INOUT,
			Back.IN, Back.OUT, Back.INOUT,
			Bounce.IN, Bounce.OUT, Bounce.INOUT,
			Elastic.IN, Elastic.OUT, Elastic.INOUT
		};
	}

	for (int i=0; i<easings.length; i++) {
		if (easingName.equals(easings[i].toString()))
			return easings[i];
	}

	return null;
}
 
Example #4
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 #5
Source File: TweenUtils.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
/** Takes an easing name and gives you the corresponding TweenEquation. You probably won't need this, but tools will love that.
 * 
 * @param easingName The name of an easing, like "Quad.INOUT".
 * @return The parsed equation, or null if there is no match. */
public static TweenEquation parseEasing (String easingName) {
	if (easings == null) {
		easings = new TweenEquation[] {Linear.INOUT, Quad.IN, Quad.OUT, Quad.INOUT, Cubic.IN, Cubic.OUT, Cubic.INOUT, Quart.IN,
			Quart.OUT, Quart.INOUT, Quint.IN, Quint.OUT, Quint.INOUT, Circ.IN, Circ.OUT, Circ.INOUT, Sine.IN, Sine.OUT,
			Sine.INOUT, Expo.IN, Expo.OUT, Expo.INOUT, Back.IN, Back.OUT, Back.INOUT, Bounce.IN, Bounce.OUT, Bounce.INOUT,
			Elastic.IN, Elastic.OUT, Elastic.INOUT};
	}

	for (int i = 0; i < easings.length; i++) {
		if (easingName.equals(easings[i].toString())) return easings[i];
	}

	return null;
}
 
Example #6
Source File: SinglePlayer.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
private void setGhostAlphasFor (boolean isTargetMode) {
	for (int g = 0; g < ghostCars.length; g++) {
		ghostCars[g].tweenAlphaTo(isTargetMode ? Config.Graphics.DefaultGhostCarOpacity
			: Config.Graphics.DefaultTargetCarOpacity, Config.Graphics.DefaultGhostOpacityChangeMs * 1.5f, Quad.OUT);
	}
}
 
Example #7
Source File: TimeModulator.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
public void toDilatedTime () {
	modulateTo(Quad.OUT, MinTime, 1000);
}
 
Example #8
Source File: TimeModulator.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
public void toNormalTime () {
	modulateTo(Quad.OUT, MaxTime, 1000);
}
 
Example #9
Source File: Tween.java    From uracer-kotd with Apache License 2.0 3 votes vote down vote up
/** Factory creating a new standard interpolation. This is the most common type of interpolation. The starting values are
 * retrieved automatically after the delay (if any). <br/>
 * <br/>
 * 
 * <b>You need to set the target values of the interpolation by using one of the target() methods</b>. The interpolation will
 * run from the starting values to these target values. <br/>
 * <br/>
 * 
 * The common use of Tweens is "fire-and-forget": you do not need to care for tweens once you added them to a TweenManager,
 * they will be updated automatically, and cleaned once finished. Common call: <br/>
 * <br/>
 * 
 * <pre>
 * {@code
 * Tween.to(myObject, POSITION, 1.0f)
 *      .target(50, 70)
 *      .ease(Quad.INOUT)
 *      .start(myManager);
 * }
 * </pre>
 * 
 * Several options such as delay, repetitions and callbacks can be added to the tween.
 * 
 * @param target The target object of the interpolation.
 * @param tweenType The desired type of interpolation.
 * @param duration The duration of the interpolation, in milliseconds.
 * @return The generated Tween. */
public static Tween to (Object target, int tweenType, float duration) {
	Tween tween = pool.get();
	tween.setup(target, tweenType, duration);
	tween.ease(Quad.INOUT);
	tween.path(TweenPaths.catmullRom);
	return tween;
}
 
Example #10
Source File: Tween.java    From uracer-kotd with Apache License 2.0 3 votes vote down vote up
/** Factory creating a new reversed interpolation. The ending values are retrieved automatically after the delay (if any). <br/>
 * <br/>
 * 
 * <b>You need to set the starting values of the interpolation by using one of the target() methods</b>. The interpolation will
 * run from the starting values to these target values. <br/>
 * <br/>
 * 
 * The common use of Tweens is "fire-and-forget": you do not need to care for tweens once you added them to a TweenManager,
 * they will be updated automatically, and cleaned once finished. Common call: <br/>
 * <br/>
 * 
 * <pre>
 * {@code
 * Tween.from(myObject, POSITION, 1.0f)
 *      .target(0, 0)
 *      .ease(Quad.INOUT)
 *      .start(myManager);
 * }
 * </pre>
 * 
 * Several options such as delay, repetitions and callbacks can be added to the tween.
 * 
 * @param target The target object of the interpolation.
 * @param tweenType The desired type of interpolation.
 * @param duration The duration of the interpolation, in milliseconds.
 * @return The generated Tween. */
public static Tween from (Object target, int tweenType, float duration) {
	Tween tween = pool.get();
	tween.setup(target, tweenType, duration);
	tween.ease(Quad.INOUT);
	tween.path(TweenPaths.catmullRom);
	tween.isFrom = true;
	return tween;
}
 
Example #11
Source File: Tween.java    From uracer-kotd with Apache License 2.0 3 votes vote down vote up
/** Factory creating a new instantaneous interpolation (thus this is not really an interpolation). <br/>
 * <br/>
 * 
 * <b>You need to set the target values of the interpolation by using one of the target() methods</b>. The interpolation will
 * set the target attribute to these values after the delay (if any). <br/>
 * <br/>
 * 
 * The common use of Tweens is "fire-and-forget": you do not need to care for tweens once you added them to a TweenManager,
 * they will be updated automatically, and cleaned once finished. Common call: <br/>
 * <br/>
 * 
 * <pre>
 * {@code
 * Tween.set(myObject, POSITION)
 *      .target(50, 70)
 *      .delay(1.0f)
 *      .start(myManager);
 * }
 * </pre>
 * 
 * Several options such as delay, repetitions and callbacks can be added to the tween.
 * 
 * @param target The target object of the interpolation.
 * @param tweenType The desired type of interpolation.
 * @return The generated Tween. */
public static Tween set (Object target, int tweenType) {
	Tween tween = pool.get();
	tween.setup(target, tweenType, 0);
	tween.ease(Quad.INOUT);
	return tween;
}
 
Example #12
Source File: Tween.java    From universal-tween-engine with Apache License 2.0 3 votes vote down vote up
/**
 * Factory creating a new standard interpolation. This is the most common
 * type of interpolation. The starting values are retrieved automatically
 * after the delay (if any).
 * <br/><br/>
 *
 * <b>You need to set the target values of the interpolation by using one
 * of the target() methods</b>. The interpolation will run from the
 * starting values to these target values.
 * <br/><br/>
 *
 * The common use of Tweens is "fire-and-forget": you do not need to care
 * for tweens once you added them to a TweenManager, they will be updated
 * automatically, and cleaned once finished. Common call:
 * <br/><br/>
 *
 * <pre> {@code
 * Tween.to(myObject, POSITION, 1.0f)
 *      .target(50, 70)
 *      .ease(Quad.INOUT)
 *      .start(myManager);
 * }</pre>
 *
 * Several options such as delay, repetitions and callbacks can be added to
 * the tween.
 *
 * @param target The target object of the interpolation.
 * @param tweenType The desired type of interpolation.
 * @param duration The duration of the interpolation, in milliseconds.
 * @return The generated Tween.
 */
public static Tween to(Object target, int tweenType, float duration) {
	Tween tween = pool.get();
	tween.setup(target, tweenType, duration);
	tween.ease(Quad.INOUT);
	tween.path(TweenPaths.catmullRom);
	return tween;
}
 
Example #13
Source File: Tween.java    From universal-tween-engine with Apache License 2.0 3 votes vote down vote up
/**
 * Factory creating a new reversed interpolation. The ending values are
 * retrieved automatically after the delay (if any).
 * <br/><br/>
 *
 * <b>You need to set the starting values of the interpolation by using one
 * of the target() methods</b>. The interpolation will run from the
 * starting values to these target values.
 * <br/><br/>
 *
 * The common use of Tweens is "fire-and-forget": you do not need to care
 * for tweens once you added them to a TweenManager, they will be updated
 * automatically, and cleaned once finished. Common call:
 * <br/><br/>
 *
 * <pre> {@code
 * Tween.from(myObject, POSITION, 1.0f)
 *      .target(0, 0)
 *      .ease(Quad.INOUT)
 *      .start(myManager);
 * }</pre>
 *
 * Several options such as delay, repetitions and callbacks can be added to
 * the tween.
 *
 * @param target The target object of the interpolation.
 * @param tweenType The desired type of interpolation.
 * @param duration The duration of the interpolation, in milliseconds.
 * @return The generated Tween.
 */
public static Tween from(Object target, int tweenType, float duration) {
	Tween tween = pool.get();
	tween.setup(target, tweenType, duration);
	tween.ease(Quad.INOUT);
	tween.path(TweenPaths.catmullRom);
	tween.isFrom = true;
	return tween;
}
 
Example #14
Source File: Tween.java    From universal-tween-engine with Apache License 2.0 3 votes vote down vote up
/**
 * Factory creating a new instantaneous interpolation (thus this is not
 * really an interpolation).
 * <br/><br/>
 *
 * <b>You need to set the target values of the interpolation by using one
 * of the target() methods</b>. The interpolation will set the target
 * attribute to these values after the delay (if any).
 * <br/><br/>
 *
 * The common use of Tweens is "fire-and-forget": you do not need to care
 * for tweens once you added them to a TweenManager, they will be updated
 * automatically, and cleaned once finished. Common call:
 * <br/><br/>
 *
 * <pre> {@code
 * Tween.set(myObject, POSITION)
 *      .target(50, 70)
 *      .delay(1.0f)
 *      .start(myManager);
 * }</pre>
 *
 * Several options such as delay, repetitions and callbacks can be added to
 * the tween.
 *
 * @param target The target object of the interpolation.
 * @param tweenType The desired type of interpolation.
 * @return The generated Tween.
 */
public static Tween set(Object target, int tweenType) {
	Tween tween = pool.get();
	tween.setup(target, tweenType, 0);
	tween.ease(Quad.INOUT);
	return tween;
}