Comments (2)
Hi Marcos,
that is not a bug. As you can see, the last result is as you expected (the X is
not 0 but almost infinitely next to it, so is considered 0 - that number is due
to floating point imprecisions that are due neither to HOTween nor to Unity,
but simply to every CPU), because the tween is complete and thus is at the
perfect end of a loop. For the rest instead, you will never have the exact "end
of loop" result you expect during an OnStepComplete callback, because HOTween
uses a very high precision tween calculation, and doesn't simply complete a
loop and wait the next frame to restart it, but calculates the correct time and
starts a loop before the next frame if needed.
Let me explain better. Let's say we have a tween of a simple number called
someNum, which goes from 0 to 1 and loops 3 times. Let's also say that we have
a slow framerate, and each frame takes 400 milliseconds to elapse.
1st frame: 400 MS have elapsed, someNum is 0.4
2nd frame: 800 MS have elapsed, someNum is 0.8
3rd frame: 1200 MS have elapsed, OnStepComplete is called. But the value of
someNum will be 0.2 this time, since we already stepped in another loop and
restarted the tween.
I worked a lot to implement this feature. Without it, each loop cycle would
"waste" some milliseconds at each completion, while waiting for the next frame
to restart. This means that 1000 loops of 1 second each won't really last 1000
seconds, but 1000 seconds + all the wasted time. With this precise tween
calculation instead, no time is wasted, and 1000 loops of 1 second each will
last 1000 seconds :)
Original comment by [email protected]
on 17 Dec 2012 at 6:58
- Changed state: Invalid
from hotween.
"and doesn't simply complete a loop and wait the next frame to restart it, but
calculates the correct time and starts a loop before the next frame if needed"
This was the answer I needed. Probably I should use a different aproach for
what I'm working.
By the way, thanks for answering so fast and for keeping HOTween update.
Original comment by [email protected]
on 17 Dec 2012 at 7:48
from hotween.
Related Issues (20)
- Hotween micro non linear ease type with curved path HOT 2
- Add loop delay for simple Tweeners
- Fails Supported API test for Windows Store HOT 1
- Visual Editor: wrong DLL referenced with HOTweenMicro and Windows 8 Store HOT 3
- Please add "_TintColor" to material color tweening HOT 4
- Null Reference Exception HOT 2
- PlugVector3Path OrientToPath2D HOT 12
- ABSTweenPlugin is allocating 20B each frame (base on Unity Profiler). Maybe, I have a way to avoid this. HOT 4
- Tween inside sequence have wrong from value HOT 1
- Building for Windows Store 8.1 with Micro produces many errors HOT 39
- HOTween OnComplete after the object is destroyed HOT 3
- Bug identified as #75 closed today has been closed but not fixed. HOT 1
- Does not show Visual Editor HOT 3
- Fail when running on Windows Store App HOT 30
- HoTween not moving objects after reloading the scene from another scene. HOT 2
- SpeedBased tween has innacurate timing HOT 5
- SetValue cause garbage allocation every frame HOT 4
- HOTween.TimeScaleIndependentUpdate is allocating 9B every frame HOT 1
- A bug about HOTween Reverse HOT 8
- Tweens playing automatically, even when 'Auto' turned off HOT 5
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 hotween.