开发者

how to find out moment after rotationX has finished

开发者 https://www.devze.com 2023-02-08 08:47 出处:网络
i am playing around with the rotationX/Y/Z properties available in flashplayer since version 10. for testing purpose i created a cube and put canvas objects on three sides of it (top, front, bottom) a

i am playing around with the rotationX/Y/Z properties available in flashplayer since version 10. for testing purpose i created a cube and put canvas objects on three sides of it (top, front, bottom) and created a tween to get the values required for turing by 90 deg. turning the cube (a canvas) using rotationX = xx works well when the three side-canvas objects are small and filled with a not-to-complex element hierarchy. when using larger and more complex content it slows down. the next idea was to remove the canvas elements content and replace it by a snapshotimage of the content instead before starting the turn, after the turn is performed the original content is put back on the sides again. this results in a good perfomance increase. using a tween the last step of rotation is done in the function that is called as the tweenEnd handler. in this function also the process of copying the canvases content back is performed. unfortunately this results in a short hang of the cube right in that last rotation step, the reason for which is that rotation and copying back takes place at the same time. so i could wait for some time after having called cube.rotationX = endValue by using a timer or setTimeout(func, 500), but this is ugly. so my question is: after having called cube.rotationX = endValue a period of time is required to calculate data for the rotation an开发者_开发技巧d do the rotation itself. is there a way to find out the point in time when the rotation has ended, so that then the copying can be started ?

thank you in advance tyler


There's no any default event, dispatching when rotation is completed. But I think of using callLater() function to copy back content. Try it.


that is exactly the point, there is not an event indicating the end of the rotation. the solution using callLater() instead of using setTimeout() appears to be an improvement however since waiting for a certain amount of time is always invloving some 'hope it works on machine x'. thank you very much for the hint !

greetings

tyler

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号