Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Tween functions?  (Read 1068 times)
0 Members and 1 Guest are viewing this topic.
Offline ddfh

Junior Member


Medals: 1



« Posted 2013-05-16 07:28:36 »

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.
Offline masteryoom

JGO Coder


Medals: 5
Projects: 2


If you look closely, you might see it turning...


« Reply #1 - Posted 2013-05-16 07:30:37 »

Are you using LWJGL? Pure java? LibGDX?

Smiley
Offline ddfh

Junior Member


Medals: 1



« Reply #2 - Posted 2013-05-16 08:21:54 »

LibGDX

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline heisenbergman

JGO Coder


Medals: 14


L___ o_ G___ a__ P___


« Reply #3 - Posted 2013-05-16 09:05:15 »

I think you could look into this Universal Tween Engine

Offline ddfh

Junior Member


Medals: 1



« Reply #4 - Posted 2013-05-16 09:36:37 »

Yes, I know that.

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

Offline Roquen
« Reply #5 - Posted 2013-05-16 09:38:16 »

Well then: splines.  3rd order Hermite is a nice easy starting point.
Offline Danny02
« Reply #6 - Posted 2013-05-16 09:56:30 »

Yes, I know that.

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

why not take a look at the sources then^^
Offline ddfh

Junior Member


Medals: 1



« Reply #7 - Posted 2013-05-16 11:12:00 »

@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.
Offline Danny02
« Reply #8 - Posted 2013-05-16 11:53:49 »

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
Online pjt33
« Reply #9 - Posted 2013-05-16 12:23:36 »

@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.
So does debugging code you don't understand because you just copy-pasted it. And that's without getting into the legal issues.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ddfh

Junior Member


Medals: 1



« Reply #10 - Posted 2013-05-16 13:10:49 »

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)
Offline heisenbergman

JGO Coder


Medals: 14


L___ o_ G___ a__ P___


« Reply #11 - Posted 2013-05-16 14:11:08 »

(Why reinvent the wheel)

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.

Offline relminator
« Reply #12 - Posted 2013-05-16 14:22:47 »

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

This.

Specifically catmull-rom.
Offline ddfh

Junior Member


Medals: 1



« Reply #13 - Posted 2013-05-16 14:52:30 »

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.
Offline davedes
« Reply #14 - Posted 2013-05-16 15:57:09 »

If you just need simple easing functions in Java, you can use my Easing utility class:
https://github.com/mattdesl/cisc226game/blob/master/SpaceGame/src/space/engine/easing/Easing.java

Here is an example of how you can wrap it for convenience:
https://github.com/mattdesl/cisc226game/blob/master/SpaceGame/src/space/engine/easing/SimpleFX.java


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
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 ..

Offline dermetfan

Senior Member


Medals: 11



« Reply #15 - Posted 2013-05-16 17:12:15 »

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).

Offline ddfh

Junior Member


Medals: 1



« Reply #16 - Posted 2013-05-16 20:27:48 »

Thank You!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 15:31:30

atombrot (34 views)
2014-08-19 05:29:53

Tekkerue (30 views)
2014-08-16 02:45:27

Tekkerue (28 views)
2014-08-16 02:22:17

Tekkerue (18 views)
2014-08-16 02:20:21

Tekkerue (27 views)
2014-08-16 02:12:11

Rayexar (65 views)
2014-08-10 22:49:23

BurntPizza (41 views)
2014-08-09 17:09:32

BurntPizza (31 views)
2014-08-07 22:01:56

Norakomi (41 views)
2014-08-06 15:49:38
List of Learning Resources
by Longor1996
2014-08-16 06:40:00

List of Learning Resources
by SilverTiger
2014-08-05 15:33:27

Resources for WIP games
by CogWheelz
2014-08-01 12:20:17

Resources for WIP games
by CogWheelz
2014-08-01 12:19:50

List of Learning Resources
by SilverTiger
2014-07-31 12:29:50

List of Learning Resources
by SilverTiger
2014-07-31 12:26:06

List of Learning Resources
by SilverTiger
2014-07-31 07:54:12

HotSpot Options
by dleskov
2014-07-07 21:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!