當前位置: 首頁>>代碼示例>>Java>>正文


Java Animation3D類代碼示例

本文整理匯總了Java中org.rajawali3d.animation.Animation3D的典型用法代碼示例。如果您正苦於以下問題:Java Animation3D類的具體用法?Java Animation3D怎麽用?Java Animation3D使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Animation3D類屬於org.rajawali3d.animation包,在下文中一共展示了Animation3D類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
 
開發者ID:BioID-GmbH,項目名稱:BWS-Android,代碼行數:25,代碼來源:RajawaliHeadRenderer.java

示例2: getCatEar

import org.rajawali3d.animation.Animation3D; //導入依賴的package包/類
private Ornament getCatEar() {
    Ornament ornament = new Ornament();
    ornament.setModelResId(R.raw.cat_ear_obj);
    ornament.setImgResId(R.drawable.ic_cat);
    ornament.setScale(11.0f);
    ornament.setOffset(0, 0.6f, -0.2f);
    ornament.setRotate(0.0f, 0.0f, 0.0f);
    ornament.setColor(0xffe06666);

    List<Animation3D> animation3Ds = new ArrayList<>();
    Animation3D anim = new RotateOnAxisAnimation(Vector3.Axis.X, -30);
    anim.setDurationMilliseconds(300);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setRepeatCount(2);
    animation3Ds.add(anim);
    ornament.setAnimation3Ds(animation3Ds);

    return ornament;
}
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:20,代碼來源:ARFacePresenter.java

示例3: getHeart

import org.rajawali3d.animation.Animation3D; //導入依賴的package包/類
private Ornament getHeart() {
    Ornament ornament = new Ornament();
    ornament.setModelResId(R.raw.heart_eyes_obj);
    ornament.setImgResId(R.drawable.ic_heart);
    ornament.setScale(0.17f);
    ornament.setOffset(0, 0.0f, 0.1f);
    ornament.setRotate(0.0f, 0.0f, 0.0f);
    ornament.setColor(0xffcc0000);

    List<Animation3D> animation3Ds = new ArrayList<>();
    Animation3D anim = new ScaleAnimation3D(new Vector3(0.3f, 0.3f, 0.3f));
    anim.setDurationMilliseconds(300);
    anim.setInterpolator(new LinearInterpolator());
    animation3Ds.add(anim);
    ornament.setAnimation3Ds(animation3Ds);
    return ornament;
}
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:18,代碼來源:ARFacePresenter.java

示例4: getAnimation3Ds

import org.rajawali3d.animation.Animation3D; //導入依賴的package包/類
public List<Animation3D> getAnimation3Ds() {
    return animation3Ds;
}
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:4,代碼來源:Ornament.java

示例5: setAnimation3Ds

import org.rajawali3d.animation.Animation3D; //導入依賴的package包/類
public void setAnimation3Ds(List<Animation3D> animation3Ds) {
    this.animation3Ds = animation3Ds;
}
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:4,代碼來源:Ornament.java

示例6: 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();
    }
}
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:72,代碼來源:ARFaceFragment.java


注:本文中的org.rajawali3d.animation.Animation3D類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。