有用的时间轴操作函数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了有用的时间轴操作函数相关的知识,希望对你有一定的参考价值。

  1. //will stop 'play', 'gotoAndPlay' and 'rewind', 'gotoAndRewind' functions
  2. MovieClip.prototype.stopAll = function () {
  3. delete this.onEnterFrame;
  4. this.stop();
  5. }
  6.  
  7. //will stop 'rewind', 'gotoAndRewind' functions
  8. MovieClip.prototype.stopRewind = function () {
  9. delete this.onEnterFrame;
  10. }
  11.  
  12. //will play the timeline backwards and continal to loop until 'stopAll', 'stopRewind' or 'pause' are called
  13. //note: the 'rewind' function will cancel the 'play' function BUT the 'play' function will not cancel the 'rewind' function
  14. //you must call 'stopAll' or 'stopRewind' before using 'play' when your timeline is playing backwards
  15. MovieClip.prototype.rewind = function () {
  16. this.stop();
  17. this.onEnterFrame = function () {
  18. if (this._currentframe > 0) {
  19. this.prevFrame ();
  20. } else {
  21. this.gotoAndStop (this._totalframes);
  22. }
  23. }
  24. }
  25.  
  26. //will goto the specified frame and play the timeline backwards and continal to loop until 'stopAll', 'stopRewind' or 'pause' are called
  27. MovieClip.prototype.gotoAndRewind = function (frame) {
  28. this.gotoAndStop (frame);
  29. this.rewind();
  30. }
  31.  
  32. //will pause the timeline for the specified amount of time. will always play forwards when the pause has finished
  33. MovieClip.prototype.pause = function (time) {
  34. delete this.onEnterFrame;
  35. secondsToPause = time;
  36. pauseInt = setInterval (this, "restart", secondsToPause * 1000);
  37. }
  38.  
  39. restart = function () {
  40. clearInterval (pauseInt);
  41. play();
  42. }

以上是关于有用的时间轴操作函数的主要内容,如果未能解决你的问题,请参考以下文章

QwtPlot - 多个 Y 轴

四元数绕轴旋转的分量

发布操作时在 Facebook 时间轴上获取“应用名称”

时间轴和操作元素属性

[pyecharts1.7] 坐标轴设置:X轴、Y轴通用

从node.js中的twitter用户时间轴获取数据