Comments (5)
is Random() a function of yours, or is this pseudocode? If it's the latter, can you paste something closer to what you're actually using?
I'll take a peek at the source myself, and see if there's anything else I might be able to suggest.
from gokit.
Pseudocode. In actual use, I'm tweening the value of a health bar for a game. Each time the tween happens, I'm changing the IntTweenProperty's endValue
param to the new health value, which could just as easily be a random int between 0 and 100.
from gokit.
Is there a reason why you're not creating a new tween, rather than trying
to edit the property?
- Michael
On Thu, Jan 28, 2016 at 8:39 AM, seandanger [email protected]
wrote:
Pseudocode. In actual use, I'm tweening the value of a health bar for a
game. Each time the tween happens, I'm changing the IntTweenProperty's
endValue param to the new health value, which could just as easily be a
random int between 0 and 100.—
Reply to this email directly or view it on GitHub
#74 (comment).
from gokit.
I'm aiming to keep the Tween in memory (as a field in this particular class) and reuse it over and over again instead of allocating a new one each time. My original goal was to re-use the property too, but the IntTweenProperty class has no way of changing the target endValue
, so I was forced to create a new property to tween with.
As an aside, I've extended IntTweenProperty and added the ability to change the endValue
, so I'm not using the above code any longer, but I think the issue still stands that anyone wanting to add properties to an already-run tween will find them non-functional.
Here's that class in case anyone is interested, note that prepareForUse()
is called each time the value is changed since GoTween won't call it after the first run.
public class IntAdjustableTweenProperty : IntTweenProperty
{
public IntAdjustableTweenProperty(string propertyName, int endValue, bool isRelative = false) : base(propertyName, endValue, isRelative)
{
}
public int EndValue
{
get { return _originalEndValue; }
set
{
_originalEndValue = value;
prepareForUse();
}
}
}
from gokit.
So I spent a bit more time looking into this, and thinking about it.
Right now we have a smattering of properties that actually have resetWithNewEndValue()
that @prime31 put in back in 2013. Perhaps if our AbstractTweenProperty also utilized generics, we could easily add the method to the AbstractTweenProperty class, and be done with it. It'd take a bit of work to do, so I'll leave this ticket open as a potential improvement to attack in the future, or as a challenge for anyone looking to dive in and help out. :)
One more thing to consider, doing something like this doesn't necessarily reset the startValue of the tween, so while doing something like this may allow you to keep a tween in memory and edit the property targets willy-nilly, you're not guaranteed to have a great looking result depending on when you do reset the desired end value to something else.
from gokit.
Related Issues (20)
- GoDummyPathEditor "Shift Path to Start at Origin" seems to be incorrect
- AbstractGoTween.goTo does not update rotation HOT 1
- Android streaming GoSpline asset bug? HOT 2
- Built-in support for inserting functions into GoTweenCollections HOT 6
- Docs: link not working anymore (README.md) HOT 3
- Doesn't compile for Windows Phone 8 HOT 1
- What do you think about rearranging this repo so it could be a submodule or a subtree? HOT 5
- GoTween Incompatible with IL2CPP scripting backend HOT 14
- [Question] Player Camera on Path HOT 1
- Canceling / destroying a tween collection HOT 4
- Changing the speed/during of a GoTween/GoTweenChain while it is playing HOT 2
- Is there a way to save all running tweens? HOT 1
- Need help with playBackwards() HOT 3
- How to check if Go has no animation running HOT 2
- [FEATURE REQUEST] ECS Support HOT 2
- [Request] Tween value without using property HOT 6
- Tweening Rotations Shortest Distance HOT 1
- Is there a way to queue Tweens by GoKit itself?
- Documentation installation (via github?) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gokit.