本文整理汇总了Java中com.jme3.animation.Animation.addTrack方法的典型用法代码示例。如果您正苦于以下问题:Java Animation.addTrack方法的具体用法?Java Animation.addTrack怎么用?Java Animation.addTrack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.animation.Animation
的用法示例。
在下文中一共展示了Animation.addTrack方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.jme3.animation.Animation; //导入方法依赖的package包/类
public @Override
void actionPerformed(ActionEvent e) {
WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
// {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
wizardDescriptor.setTitle("Create a new AudioTrack");
Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
dialog.setVisible(true);
dialog.toFront();
boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
if (!cancelled) {
AudioNode audio = (AudioNode) wizardDescriptor.getProperty("Audio");
float startOffset = (Float) wizardDescriptor.getProperty("startOffset");
Animation anim = animation.getLookup().lookup(Animation.class);
anim.addTrack(new AudioTrack(audio, anim.getLength(), startOffset));
animation.refresh(false);
animation.setChanged();
}
}
示例2: actionPerformed
import com.jme3.animation.Animation; //导入方法依赖的package包/类
public @Override
void actionPerformed(ActionEvent e) {
WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
// {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
wizardDescriptor.setTitle("Create a new EffectTrack");
Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
dialog.setVisible(true);
dialog.toFront();
boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
if (!cancelled) {
ParticleEmitter emitter = (ParticleEmitter) wizardDescriptor.getProperty("Emitter");
float startOffset = (Float) wizardDescriptor.getProperty("startOffset");
Animation anim = animation.getLookup().lookup(Animation.class);
anim.addTrack(new EffectTrack(emitter, anim.getLength(), startOffset));
animation.refresh(false);
animation.setChanged();
}
}
示例3: sampleCube
import com.jme3.animation.Animation; //导入方法依赖的package包/类
public static Spatial sampleCube(SimpleApplication app) {
Geometry cube = Helper.makeShape("cube", new Box(0.5f, 0.5f, 0.5f), ColorRGBA.Brown, app.getAssetManager(), false);
cube.setUserData("sample String", "string");
cube.setUserData("sample int", 42);
cube.setUserData("sample float", 42.0f);
cube.setUserData("sample vector3f", new Vector3f(-2.0f, 3.0f, 4.0f));
AnimControl ac = new AnimControl();
Animation aniY = new Animation("Y basic translation", 10);
aniY.addTrack(new SpatialTrack(new float[]{0, 5 , 10}, new Vector3f[]{new Vector3f(0, -5, 0), new Vector3f(0, 5, 0), new Vector3f(0, -5, 0)}, null, null));
ac.addAnim(aniY);
Animation aniX = new Animation("X basic translation", 10);
aniX.addTrack(new SpatialTrack(new float[]{0, 5 , 10}, new Vector3f[]{new Vector3f(-5, 0, 0), new Vector3f(5, 0, 0), new Vector3f(-5, 0, 0)}, null, null));
ac.addAnim(aniX);
Animation aniZ = new Animation("Z basic translation", 10);
aniZ.addTrack(new SpatialTrack(new float[]{0, 5 , 10}, new Vector3f[]{new Vector3f(0, 0, -5), new Vector3f(0, 0, 5), new Vector3f(0, 0, -5)}, null, null));
ac.addAnim(aniZ);
cube.addControl(ac);
return cube;
}
示例4: spawnEvent
import com.jme3.animation.Animation; //导入方法依赖的package包/类
void spawnEvent(InputEvent evt) {
addInfo(InputMapperHelpers.toString(evt, false));
Quad q = new Quad(0.5f, 0.5f);
Geometry g = new Geometry("Quad", q);
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
//mat.setColor("Color", ColorRGBA.Blue);
String path = inputTextureFinders.findPath(evt);
mat.setTexture("ColorMap", app.getAssetManager().loadTexture(path));
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
g.setQueueBucket(Bucket.Transparent);
g.setMaterial(mat);
BillboardControl billboard = new BillboardControl();
g.addControl(billboard);
spawnEventCnt++;
Animation anim = new Animation("goUp", 6.0f);
anim.addTrack(new TranslationTrack(new Vector3f((spawnEventCnt % 10) - 5f,10f,0f), 5.0f));
anim.addTrack(new RemoveTrack(5.0f));
AnimControl ac = new AnimControl();
ac.addAnim(anim);
g.addControl(ac);
g.setLocalTranslation(scene.getChild("player").getWorldTranslation());
app.enqueue(()-> {
scene.attachChild(g);
AnimChannel c = ac.createChannel();
c.setLoopMode(LoopMode.DontLoop);
c.setAnim("goUp");
return true;
});
}
示例5: buildAnimation
import com.jme3.animation.Animation; //导入方法依赖的package包/类
/**
* builds the animation for jmonkey. every joint uses two jme bones, one for
* rotation and one for translation.
*/
public void buildAnimation() {
if (seq.shp != null) {
animation = new Animation("Animation" + id, 0.5f);
for (int i = 0; i < seq.numJoints; ++i) {
float[] times = { 0.0f };
// rotation bone
BoneTrack track = new BoneTrack(i);
Vector3f[] translations = { Vector3f.ZERO };
Quaternion[] rotations = { quaternions[i] };
track.setKeyframes(times, translations, rotations);
animation.addTrack(track);
// translation bone
// not for root
if (i > 0) {
BoneTrack track2 = new BoneTrack(i + seq.numJoints);
Vector3f[] translations2 = { new Vector3f(
seq.shp.joints[i].length, 0, 0) };
Quaternion[] rotations2 = { Quaternion.IDENTITY };
track2.setKeyframes(times, translations2, rotations2);
animation.addTrack(track2);
}
}
}
}
示例6: toJME
import com.jme3.animation.Animation; //导入方法依赖的package包/类
public Animation toJME(Skeleton sk){
Animation anim=new Animation(getName(),getDuration());
for(XbufTrack t:tracks)anim.addTrack(t.toJME(sk));
return anim;
}