使用rajawali在动态壁纸中创建移动背景

时间:2014-04-05 06:00:27

标签: background live-wallpaper rajawali

我正在使用rajawali创建动态壁纸。我在其上加载了一个对象(使用此代码:Rajawali object rotation match to camera),现在我想在后台设置移动图像。有人给我建议吗?

1 个答案:

答案 0 :(得分:0)

我创建了Plane:

        mPlane1 = new Plane();
    Material material1 = new Material();
    try {
        material1.addTexture(new Texture("cloud2", R.drawable.cloud2));
    } catch (TextureException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    material1.setColorInfluence(0);
    mPlane1.setMaterial(material1);
    mPlane1.setRotY(180);
    mPlane1.setTransparent(true);
    mPlane1.setPosition(Vector3.X);
    mPlane1.setPosition(-1.6f, 1.2, 1.6);
    getCurrentScene().addChild(mPlane1);

并使用TranslateAnimation3D进行翻译:

plane1Anim = new TranslateAnimation3D(Vector3.X);
    plane1Anim.setRepeatMode(RepeatMode.INFINITE);
    plane1Anim.setTransformable3D(mPlane1);
    plane1Anim.setDuration(16000);
    getCurrentScene().registerAnimation(plane1Anim);
    plane1Anim.play();