<template color="green">
<dummy>
<label>绘制一条线段:</label>
<label>名称为:</label>
<text name="name">myLine</text>
<label>起点位置</label>
<label>X:</label>
<number name="startX"></number>
<label>y:</label>
<number name="startY"></number>
<label>z:</label>
<number name="startZ"></number>
<label>终点为:</label>
<label>X:</label>
<number name="endX"></number>
<label>y:</label>
<number name="endY"></number>
<label>z:</label>
<number name="endZ"></number>
<label>颜色为:</label>
<color name="myColor"></color>
</dummy>
</template>
<script>
function code(block) {
const startX = <code>'${block.getFieldValue('startX')}'</code>;
const startY = <code>'${block.getFieldValue('startY')}'</code>;
const startZ = <code>'${block.getFieldValue('startZ')}'</code>;
const endX = <code>'${block.getFieldValue('endX')}'</code>;
const endY = <code>'${block.getFieldValue('endY')}'</code>;
const endZ = <code>'${block.getFieldValue('endZ')}'</code>;
const myColor = <code>'${block.getFieldValue('myColor')||'#660000'}'</code>;
const fun = Plug.provide('myFunction1', function(startX, myColor,) {
var times = [0, 10];
var position_x = [0, 0, 0, 100, 0, 0];
var pos1_Keyframe = new v3d.KeyframeTrack('.mesh[car].position', times, position_x);
var duration = 10;
var clip = new v3d.AnimationClip('boxAnimation', duration, [
pos1_Keyframe
]);
var mixer = new THREE.AnimationMixer(app.scene);
var action = mixer.clipAction(clip);
app.actions.push(action);
console.log("====================app.actions")
console.log(app.actions);
});
return <code>${fun}(${startX}, ${myColor});</code>;
}
</script>
I want create my Animation,How can I binding the mesh “car” with Animation?I sure ,the “car” is mesh in app.scene