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.

AppGameKit Classic Chat / Is it possible to access the tween functions numerically ?

Author
Message
paulrobson
9
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 16th Feb 2015 13:09
AGK2 has quite a few tweens built in. Most of these are at core some sort of function that takes a proportion of elapsed time and returns a value showing how far the tween has gone - is there a way of accessing these tweens numerically ?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th Feb 2015 15:30
In Tier 1 there isn't. I don't know if Tier 2 exposes more.

Before tweens I had my own functions to do the same, so I understand what you're talking about, I guess you want to know for example, what position a sprite is at 75% of the way through an ease-in tween?

I'm going to guess at something else...do you want to use the values for other functions beyond what tweens can do? If so, you could make an invisible sprite, apply a tween, and get it's position (getSpriteX) in order to extract the value. I'm thinking of doing this for a number of effects, such as Sound Instance Rates. Sound doesn't have tweens, but I can get the values from a moving sprite and apply them.

Quidquid latine dictum sit, altum sonatur
paulrobson
9
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 16th Feb 2015 18:00
I'm writing a library which makes animating text much easier, could apply the tweens to get some extra effects, bouncing text on the screen and so on, at present all the movement is linear. I did wonder about hacking it out of a sprite but it does seem an awful hack
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th Feb 2015 18:36
What do you mean exactly by linear?
This little test I did has various non-linear tweens



Quidquid latine dictum sit, altum sonatur
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 16th Feb 2015 19:18
I still use the tween system that can be found on the AppGameKit website in the codebase section, rather than the built in system.

It has better functionality, with bidirectional looping tweens etc. Plus you can extend it easily to match your needs. I extended it to use with the particle system so that I could animate particle emitters.

You should download it and give it a try.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 16th Feb 2015 19:40
I still end up using custom tweening functions a lot because the ones provided are extremely restrictive when it comes to customization and specialized use.

Rather than just having the currently replicated sets of Tween commands that must always be bound to the major elements (camera, sprite, text...) I would sure appreciate having core 'Tween' commands that simply manipulate a float variable, which can then be applied to any or multiple elements, or compounded with other values and dynamics.

I can't recall other specific issues I found with the tween commands but seem to think they don't take offsets into consideration or at least they didn't when I last focused on them.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th Feb 2015 23:49
Quote: "I still end up using custom tweening functions a lot because the ones provided are extremely restrictive when it comes to customization and specialized use."


This could be alleviated by allowing a template tween to be applied. This is what I use in my own system. It would allow you to supply an array of values to interpolate between.

For example, I created a random template of 100 values. This went from 0.0 to 1.0, but with each value offset by up to 20%. Think of it as a flickering light effect.

I also created a stepped effect, where the values went up like a square wave, rather than smoothly. You can still apply easeIn etc over the top to get some cool effects.

Quidquid latine dictum sit, altum sonatur
paulrobson
9
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 17th Feb 2015 18:08
In the end I borrowed the functions from an LPGL library (attributed, obviously). Anyway it is now ready for people to play with if interested.

https://github.com/agkdev/library-fontfx
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Feb 2015 18:16
Very nice indeed.

Although I question your claim to be a programmer - comments everywhere and documentation! I've never seen such a thing!!

If it was hard to write it should be harder to understand

Seriously...nice work

Quidquid latine dictum sit, altum sonatur

Login to post a reply

Server time is: 2024-05-18 19:36:15
Your offset time is: 2024-05-18 19:36:15