Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / What does "Tween" mean in AGK

Author
Message
SirRolo
8
Years of Service
User Offline
Joined: 24th Mar 2016
Location:
Posted: 18th Dec 2017 03:08
I have no idea what the word tween means and how it applies to AGK. If someone could help me understand it, I would be great-full.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Dec 2017 09:11
A tween gets an entity from one state to another over time.

For example,
* from position A to position B
* From 100% transparent to 100% opaque
* From 1 pixel high to 100 pixels high

The last parameter of a tween describes how to do it. For example:

* Linearly
* Start fast, finish slow
* Overshoot at the end before returning to final position


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 18th Dec 2017 12:08
You're using millisecs/seconds to change values rather then updating a value per frame which might not be accurate if the client cannot keep up with the FPS you set.

For example my goal is to move a sprite 60px in 1 second; I could move the sprite at 1px per frame which will work great as long as I can maintain 60FPS, but if I or a player of my game can only get 30FPS it will take 2 seconds. A better method is to use a 1 second tween that way it doesn't matter if I can or cannot maintain 60FPS, the game could run at 1FPS or 1000FPS the sprite will still take no more or no less than 1 second.
SirRolo
8
Years of Service
User Offline
Joined: 24th Mar 2016
Location:
Posted: 18th Dec 2017 19:30
Awesome, thanks guys. That helps a lot.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 18th Dec 2017 20:34
Just a bit of history.
Tween comes from the animation studios where a top animator would draw the key frames for an animation and then
they would hand it down to an intern to do the inbetween animations. In house they were called "tweens"
SirRolo
8
Years of Service
User Offline
Joined: 24th Mar 2016
Location:
Posted: 19th Dec 2017 01:22
So if I get this idea right, it is updating the tween commands off of the internal clock instead of waiting for the sync() command?
puzzler2018
User Banned
Posted: 19th Dec 2017 01:40 Edited at: 19th Dec 2017 01:41
Play teen and then UpateTweens and then Sync (I think)
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 19th Dec 2017 08:29
@SirRolo - at each UpateTweens it calculates how much it needs to update the tween value to keep to it's tween time limit, even if the FPS fluctuates between 30 and 60 during the tween time it will still get from the start value to the end value in that time by adjusting how much to increase the value at each UpateTweens call.
SirRolo
8
Years of Service
User Offline
Joined: 24th Mar 2016
Location:
Posted: 20th Dec 2017 05:40
Wow, there is a little bit more to it than I thought.

Login to post a reply

Server time is: 2024-11-24 04:32:45
Your offset time is: 2024-11-24 04:32:45