本文整理匯總了Java中org.rajawali3d.animation.Animation3D.setTransformable3D方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation3D.setTransformable3D方法的具體用法?Java Animation3D.setTransformable3D怎麽用?Java Animation3D.setTransformable3D使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.rajawali3d.animation.Animation3D
的用法示例。
在下文中一共展示了Animation3D.setTransformable3D方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: rotateModel
import org.rajawali3d.animation.Animation3D; //導入方法依賴的package包/類
/**
* Does rotate the 3D head by the specified angle around the specified axis.
*
* @param axis for the rotation
* @param angle for the rotation
* @param animationDurationInMillis how long the animation should take
*/
@SuppressWarnings("SameParameterValue")
void rotateModel(@NonNull Vector3.Axis axis, @IntRange(from = 0, to = 360) int angle,
@IntRange(from = 0) int animationDurationInMillis) {
if (!getSceneInitialized()) {
return;
}
stopActiveAnimation();
Animation3D animation = new RotateOnAxisAnimation(axis, angle);
animation.setDurationMilliseconds(animationDurationInMillis);
animation.setTransformable3D(head);
animation.play();
getCurrentScene().registerAnimation(animation);
lastAnimation = animation;
}
示例2: showMaskModel
import org.rajawali3d.animation.Animation3D; //導入方法依賴的package包/類
void showMaskModel() {
try {
boolean isFaceVisible = true;
boolean isOrnamentVisible = true;
if (mMonkey != null) {
isFaceVisible = mMonkey.isVisible();
mMonkey.setScale(1.0f);
mMonkey.setPosition(0, 0, 0);
mContainer.removeChild(mMonkey);
}
if (mOrnament != null) {
isOrnamentVisible = mOrnament.isVisible();
mOrnament.setScale(1.0f);
mOrnament.setPosition(0, 0, 0);
mContainer.removeChild(mOrnament);
}
String modelDir = OBJUtils.getModelDir();
String imagePath = modelDir + OBJUtils.IMG_FACE;
String objPath = OBJUtils.DIR_NAME + File.separator + FileUtils.getMD5(imagePath) + "_obj";
LoaderOBJ parser = new LoaderOBJ(this, objPath);
parser.parse();
mMonkey = parser.getParsedObject();
ATexture texture = mMonkey.getMaterial().getTextureList().get(0);
mMonkey.getMaterial().removeTexture(texture);
mMonkey.setScale(0.06f);
mMonkey.setY(-0.54f);
mMonkey.setZ(0.15f);
mMonkey.setVisible(isFaceVisible);
String texturePath = FileUtils.getMD5(imagePath) + ".jpg";
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFilePath(modelDir + texturePath, 1024, 1024);
mMonkey.getMaterial().addTexture(new Texture("canvas", bitmap));
mMonkey.getMaterial().enableLighting(false);
mContainer.addChild(mMonkey);
if (mOrnamentId >= 0 && mOrnaments.size() > mOrnamentId) {
Ornament ornament = mOrnaments.get(mOrnamentId);
LoaderOBJ objParser1 = new LoaderOBJ(mContext.getResources(), mTextureManager, ornament.getModelResId());
objParser1.parse();
mOrnament = objParser1.getParsedObject();
mOrnament.setScale(ornament.getScale());
mOrnament.setPosition(ornament.getOffsetX(), ornament.getOffsetY(), ornament.getOffsetZ());
mOrnament.setRotation(ornament.getRotateX(), ornament.getRotateY(), ornament.getRotateZ());
int color = ornament.getColor();
if (color != ARFacePresenter.NO_COLOR) {
mOrnament.getMaterial().setColor(color);
}
mOrnament.setVisible(isOrnamentVisible);
mContainer.addChild(mOrnament);
getCurrentScene().clearAnimations();
List<Animation3D> animation3Ds = ornament.getAnimation3Ds();
if (animation3Ds != null && animation3Ds.size() > 0) {
final AnimationGroup animGroup = new AnimationGroup();
animGroup.setRepeatMode(Animation.RepeatMode.REVERSE_INFINITE);
for (Animation3D animation3D : animation3Ds) {
animation3D.setTransformable3D(mOrnament);
animGroup.addAnimation(animation3D);
}
getCurrentScene().registerAnimation(animGroup);
animGroup.play();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}