我正在尝试在两个移动顶点之间画一条线。顶点的绘图存储在名为Path = "D:\Test.pdf"
Set App = CreateObject("Acroexch.app")
app.show
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set AForm = CreateObject("AFormAut.App") 'from AFormAPI
If AVDoc.Open(Path,"") Then
'// write some js code on a vbs variable
js = "f = this.addField(""newField"", ""text"", 0, [250,650,20,600]);" &vblf _
& "f.value = ""any Text""; " &vblf _
& "f.flatten"
'//execute the js code
AForm.Fields.ExecuteThisJavaScript js
end if
Set AForm = Nothing
Set AVDoc = Nothing
Set APP = Nothing
的变量中,该变量的object
为position
。
这条线就是这样创造的:
THREE.Vector3
...,其中source和target是顶点,顶点通过以下方式更新:
var Line = function(scene, source, target){
var geometry = new THREE.Geometry();
geometry.dynamic = true;
geometry.vertices.push(source.object.position);
geometry.vertices.push(target.object.position);
geometry.verticesNeedUpdate = true;
var material = new THREE.LineBasicMaterial({ color: 0x000000 });
var line = new THREE.Line( geometry, material );
scene.add(line);
return line;
};
现在,我已将vertex.object.position.add(vertex.velocity);
和source.object.position
分配给target.object.position
和line.geometry.vertices[0]
,因为我希望其中一个更新。但相反,顶点位置从线位置变化很大。顶点就在它们的位置,但这些线不会连接到顶点。
如何使线条与顶点一起移动?