简体   繁体   中英

How to dynamically change the image with animation using RajawaliVR

I am able to change image dynamically using this code :

public void changeImage()
    {
       Log.d("debug1", "" + getCurrentScene().getNumChildren());
        ArrayList<Object3D> objectList = getCurrentScene().getChildrenCopy();
        Material material = objectList.get(0).getMaterial();
        for (ATexture texture : material.getTextureList())
        {
            material.removeTexture(texture);
            texture = null;
        }

        Texture t = new Texture("sphereTexture",R.drawable.newImage);
        t.shouldRecycle(true);
              try {
                  material.addTexture(t);
              }
              catch (Exception e){e.printStackTrace();}

    }

Now I want to change image with animation .Please help how to animate sphere .

Try this,

On click of your imageview, add an animation.

Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator()); 
fadeIn.setDuration(500);

Image.setAnimation(fadeIn);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM