public class MainActivity extends Activity {
LinearLayout rotator;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rotator = (LinearLayout) findViewById(R.id.rotator);
ObjectAnimator rotation = ObjectAnimator.ofFloat(rotator, "rotationY", 0, 360);
rotation.setDuration(3000);
rotation.start();
}
}
I've got above code, which is rotating View around Y axis. Problem is, that the perspective seems to be too "strong" - the edge of view that is in foreground becomes too big and the edge in background becomes too small. Is there any possibility to "lower down" the perspecitve factor?
How? Click the picture that you want to apply the effect to, and then click the Format Picture tab. Under Picture Styles, click Effects, point to 3-D Rotation, and then click the effect that you want, such as Isometric Left Down.
On the Animations tab of the ribbon, select one of the 3D animation effects. Select the animation effect you want. On the ribbon, select Effect Options to open the menu. You can choose properties related to the Direction, Intensity, and Rotation Axis of movement.
That's what 3D rotation does–it shows you an object from an angle.
Select the text box and choose FORMAT → WordArt Styles → Text Effects → 3-D Rotation → Perspective Relaxed Moderately.
int distance = 1900;
float scale = getResources().getDisplayMetrics().density;
rotator.setCameraDistance(distance * scale);
So this is the solution for all screen densities.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With