更改 Javascript 循环速度

更改 Javascript 循环速度

我正在使用 latex 和 media9 创建 3D pdf,并为我的 .u3d 对象添加了一些视图。现在我找到了一个可以自动更改视图的脚本:关联

是否可以更改这些脚本以便在视图之间更流畅地旋转?

改变速度也不错。我改变了视图之间的时间,但现在它旋转得非常快。但它仍然在先前定义的视点短暂停留。如果我进一步降低时间,它会跳过视图。

\documentclass[a4paper]{article}
\usepackage{media9}
\usepackage{tikz} % for creating a poster
\usepackage{graphicx}
\usepackage{filecontents}

%filecontents in the lower comment

\begin{document}
 \includemedia[
%   draft,
  width=\linewidth  ,height=\linewidth,
  activate=pageopen,
  3Dtoolbar, 3Dmenu,
  3Dviews=views.vws,
  add3Djscript=3Dspintool.js, % turntable rotation of 3D object
  add3Djscript=viewchange.js
]{\includegraphics{example-image}}{dice.u3d}
\end{document}

附加文件:骰子.u3d

%.js file muss manuell erstellt werden (ohne inhalt)
%\begin{filecontents*}{changeView.js} 
%var time=0; 
%var curViewIdx=0;
%
%timeEvHnd=new TimeEventHandler();
%timeEvHnd.onEvent=function(event) {
%  time += event.deltaTime;
%  if (time>=5) {
%    time = 0;
%    curViewIdx++;
%    if(curViewIdx == runtime.viewCount) curViewIdx=0;
%    runtime.setView(curViewIdx, true);
%  }
%}
%
%runtime.addEventHandler(timeEvHnd);
%// runtime.pause();
%\end{filecontents*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{filecontents*}{3Dspintool.js} 
%runtime.setCurrentTool(runtime.TOOL_NAME_SPIN);
%\end{filecontents*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{filecontents*}{views.vws}
%VIEW=1
%  COO=3.8412740230560303 0.7929028272628784 -1.2368221282958984
%  C2C=0.6128408908843994 -0.5093194842338562 0.6041686534881592
%  ROO=22.314074206985236
%  LIGHTS=Headlamp
%END
%VIEW=2
%  COO=3.8412740230560303 0.7929028272628784 -1.2368221282958984
%  C2C=0.62525874376297 -0.015961874276399612 0.7802542448043823
%  ROO=22.31407283934709
%  LIGHTS=Headlamp
%END
%VIEW=3
%  COO=3.8412740230560303 0.7929028272628784 -1.2368221282958984
%  C2C=0.5805690288543701 0.5310713052749634 0.6171732544898987
%  ROO=24.54547258883754
%  LIGHTS=Headlamp
%END
%VIEW=4
%  COO=3.8412740230560303 0.7929028272628784 -1.2368221282958984
%  C2C=0.39592796564102173 0.8039077520370483 0.4438166618347168
%  ROO=27.00001243308452
%  LIGHTS=Headlamp
%END
%VIEW=5
%  COO=3.8412740230560303 0.7929028272628784 -1.2368221282958984
%  C2C=-0.8026273846626282 0.48044249415397644 0.3535027801990509
%  ROO=26.999997739438562
%  LIGHTS=Headlamp
%END
%VIEW=6
%  COO=3.8412740230560303 0.7929028272628784 -1.2368221282958984
%  C2C=-0.706401526927948 -0.5793313980102539 0.4066595733165741
%  ROO=26.999995478876937
%  LIGHTS=Headlamp
%END
%VIEW=7
%  COO=3.8412740230560303 0.7929028272628784 -1.2368221282958984
%  C2C=0.3001320958137512 -0.738174319267273 0.6041684150695801
%  ROO=27.00000226056125
%  LIGHTS=Headlamp
%END
%\end{filecontents*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

相关内容