Biraj Zalavadia
Biraj Zalavadia

Reputation: 28484

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.

Upvotes: 1

Views: 163

Answers (1)

Parth Bhayani
Parth Bhayani

Reputation: 1924

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);

Upvotes: 0

Related Questions