如何找出rotationX完成后的时刻

发布于 2024-10-15 00:51:07 字数 606 浏览 3 评论 0原文

我正在尝试自版本 10 以来 Flashplayer 中提供的rotationX/Y/Z 属性。出于测试目的,我创建了一个立方体并将画布对象放在它的三个侧面(顶部、前面、底部),并创建了一个补间来获取值需要图灵 90 度。当三个侧面画布对象很小并且填充了不复杂的元素层次结构时,使用rotationX = xx 转动立方体(画布)效果很好。当使用更大、更复杂的内容时,速度会变慢。下一个想法是在开始转动之前删除画布元素内容并将其替换为内容的快照图像,在执行转动之后,原始内容再次放回侧面。这会带来良好的性能提升。使用补间,旋转的最后一步是在称为 tweenEnd 处理程序的函数中完成的。在此函数中,还执行将画布内容复制回来的过程。不幸的是,这会导致立方体在最后一个旋转步骤中短暂悬挂,其原因是旋转和复制回同时发生。 所以我可以在使用计时器或 setTimeout(func, 500) 调用 cube.rotationX = endValue 后等待一段时间,但这很丑陋。 所以我的问题是:在调用 cube.rotationX = endValue 之后,需要一段时间来计算旋转数据并进行旋转本身。有没有办法找出轮换结束的时间点,以便可以开始复制?

先感谢您 泰勒

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 and 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒解孤独 2024-10-22 00:51:07

没有任何默认事件,在轮换完成时调度。但我想使用 callLater() 功能复制回内容。尝试一下。

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

帝王念 2024-10-22 00:51:07

正是这一点,没有任何事件指示旋转结束。使用callLater()而不是使用setTimeout()的解决方案似乎是一个改进,但是因为等待一定时间总是涉及到一些“希望它能在机器上运行”的问题x'。非常感谢您的提示!

问候

泰勒

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文