Tween functions?

Hi,

I want to make tween animations in a game.

E.g. when the player gets a coin, I want to show on the position of the coin the score
and then the score is moving up and is going transparent. (Floating score)

I know, there are tween libraries. But I’m searching only for the algorithm.
Not only for the floating score.

All the functions the are useful for games.

Another example: The text “Game over” is coming from up to the center of the screen and waiting for
3 seconds and then is moving to the bottom screen.

I can make tween animations myself. But it takes time.

Are you using LWJGL? Pure java? LibGDX?

LibGDX

I think you could look into this Universal Tween Engine

Yes, I know that.

But I’m searching only for the algorithm or functions.

Well then: splines. 3rd order Hermite is a nice easy starting point.

why not take a look at the sources then^^

@Danny02 Yes, that’s correct but I wanted to speed up my programming. I mean, copy & paste and use the function.

Of course I can look at the code. But this takes time.

Then you have to learn young padawan. Reading other code/APIs is one of the main ability of a programer.

look took me 30sec to find this extremly well hidden package called “equations” here

So does debugging code you don’t understand because you just copy-pasted it. And that’s without getting into the legal issues.

I always look at the license.

I’m searching for codes that are written and all can use it in the game.

I do not know how to say this.

E.g. when somebody wants to make a website, he looks for written Layouts. And of course to the license.
And then the programmer downloads or copy & pastes that layout in the file.

And that’s, what I’m searching for. Written tweens. (Why reinvent the wheel)

[quote=“ddfh,post:11,topic:41981”]
You’re not reinventing the wheel… you’re just building one so that you know how it works… and maybe create your own version of the same thing (which is different from “reinventing”).

Personally, I don’t have any sources for tweening that you ask for. I’m sure googling will probably help.

But the best course of action imo is to look at the API and figure out how to implement it yourself.

This.

Specifically catmull-rom.

OK. I will try to use Universal Tween Engine.

I tried that before. But I was not happy of that engine. No great tutorials etc.

Now… after many hours trying… it’s ok.

If you just need simple easing functions in Java, you can use my Easing utility class:

Here is an example of how you can wrap it for convenience:

private SimpleFX fx = new SimpleFX(1f, 0f, 1000, Easing.QUAD_OUT);


	//update method...
		fx.update(delta); /** your game might use a float delta in seconds, instead of int in ms */
		if (fx.finished()){
			//do something when finished..
		}

	//render....
		//gets the tweened value between start (in this case 1.0) and end (0.0)
		float tween = fx.getValue();

		//.. do something with the value ..

I think using an already made library is better than pasting code into your project… And the Tween Engine is pretty cool and actually easy to use, too.
You probably don’t need it anymore, but there is at least one tutorial out there: http://www.youtube.com/watch?v=2PqwxYVlivA&list=PLXY8okVWvwZ0JOwHiH1TntAdq-UDPnC2L (Yes, this is a shameless self-advertisement).

Thank You!