Android3D旋转动画库--Rotate3D

运行效果:

Android3D旋转动画库--Rotate3D_第1张图片

使用方法:

在build.gradle中添加依赖:

implementation 'com.jzp:rotate3D:1.0.0'

创建Rotate3D:

 Rotate3D  anim = new Rotate3D.Builder(this)        
                 .bindParentView(parent_ll) 
                 .bindPositiveView(account_login_ll)         
                 .bindNegativeView(account_phone_ll)  
                 .create();

启动3D动画:

 anim.transform();

 简单Demo:

  view布局:activity_main.xml




    

        

    

    

        
            

            

                

                

                
            

            

            

                

                

                

            

            
        

        

            

            

                

                

                

                
            

            

            

                

                

                

                

            

            

        

        

Control层:MainActivity.java

public class MainActivity extends AppCompatActivity {

    Rotate3D rotate;
    private LinearLayout account_login_ll;
    private LinearLayout account_phone_all;
    private LinearLayout parent_ll;
    private TextView no_pass_login;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        account_login_ll=findViewById(R.id.account_login_ll);
        account_phone_all=findViewById(R.id.account_phone_ll);
        parent_ll=findViewById(R.id.parent_ll);
        no_pass_login=findViewById(R.id.no_pass_login);
        rotate=new Rotate3D.Builder(this).
                setParentView(parent_ll).
                setPositiveView(account_login_ll).
                setNegativeView(account_phone_all).create();//创建Rotate3D
        no_pass_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                rotate.transform();//启动Rotate3D
                if(rotate.isOpen()){
                    no_pass_login.setText("使用免密登录");
                }else {
                    no_pass_login.setText("使用账户登录");
                }
            }
        });
    }
}

源码:https://github.com/dpl12/3DLoginAnimation

你可能感兴趣的:(Android,Native,基础)