Last active
October 28, 2015 03:09
-
-
Save braindroplabs/36c97ea160c6bcf84270 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In EX1, my objects would render (seemingly a single frame) at the ZKpositionTo position before starting from the setFrom() position. Not every time, but sometimes. | |
I'm used to Greensock's (AS3/JS) Tween library and I never ran into this issue, so I may be bringing expectations over incorrectly. | |
In EX2, I explicitly set the from position and then only use ZKpositionTo. This works as expected. | |
You mentioned on Twitter that "the first tick is a 0 elapsedTime tick", and I'm assuming this may be the culprit of the unwanted frame render. | |
Any way to alleviate the issue? Any other thoughts? Or is this expected behavior? | |
*/ | |
//EX1 - this example has the issue | |
foreach(GameObject tile in gameTiles) { | |
pos = tile.transform.position; | |
//add animate | |
tile.transform.ZKpositionTo(pos, tweenTime) | |
.setFrom(new Vector3(pos.x, pos.y - GRID_COUNT_ROWS_OFF_SCREEN, pos.z)) | |
.setEaseType( EaseType.CubicOut ) | |
.start(); | |
} | |
//EX2 - this example doesn't have the issue | |
foreach(GameObject tile in gameTiles) { | |
//update | |
pos = tile.transform.position; | |
fromPos = new Vector3(pos.x, pos.y - GRID_COUNT_ROWS_OFF_SCREEN, pos.z); | |
tile.transform.position = fromPos; | |
//add animate (setFrom() used previously, but an unwanted render tick would occur) | |
tile.transform.ZKpositionTo(pos, tweenTime) | |
.setEaseType( EaseType.CubicOut ) | |
.start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment