Git Product home page Git Product logo

3dviewandroid's Introduction

3dViewAndroid

note:

这是一个简易的可以旋转的自定义ViewGruop,可以自定义Interpolate来做变速旋转。

demo,第一个是匀速的,第二个是变速的(图片加载的有点慢)

image image

usage:

引用:

首先在项目的 build.gradle->allproject->repositories中加入:
    allprojects {
        repositories {
        maven { url 'https://jitpack.io' }
    }
}
然后app的build.gradle->dependencies中加入:
    compile 'com.github.chenxin185:3dViewAndroid:1.0.2'

使用方法

在layout文件中声明:

 <com.xingmeng.chenxin.my3drotateview.My3dRotateView
    android:id="@+id/mView"
    android:layout_width="match_parent"
    android:layout_height="300dp"
    app:childHeight="50dp"
    app:childWidth="50dp"
    app:margin_ovalHeight="100dp"
    app:margin_ovalWidth="50dp">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@mipmap/ic_launcher" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@mipmap/ic_launcher" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@mipmap/ic_launcher" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@mipmap/ic_launcher" />
    
</com.xingmeng.chenxin.my3drotateview.My3dRotateView>

在Activity中:

    my3dView = (My3dRotateView) findViewById(R.id.mView);
    //Item的点击事件
    my3dView.setItemClickListener(new My3dRotateView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position, boolean isFirst) {
            Log.e("infoo","onItemClick position = "+position);
        }
    });
    //自定义的插值器,返回的是每一帧改变的角度
    my3dView.setInterpolate(new My3dRotateView.My3dInterpolate() {
        @Override
        public double getInterpolation(float timing) {
            return 0;
        }
    });

属性和方法:

    childHeight:子view的高度
    childWidth:子view的宽度
    ovalHeight:旋转轨迹的高度(旋转的轨迹就是一个椭圆,这里的宽高就是椭圆的宽高)
    ovalWidth:旋转轨迹的宽度
    margin_ovalWidth:旋转轨迹的宽度与父容器左右两边的margin,设置了这个属性,上面的ovalWidth无效
    margin_ovalHeight:旋转轨迹的高度与父容器上下两边的margin,设置了这个属性,上面的ovalHeight无效
    setItemClickListener():设置子view的点击事件
    setInterpolate():设置速度插值器,来控制速度的变化

end

    希望大家可以关注下我的博客,一起学习一起进步哈:     下课睡觉

3dviewandroid's People

Contributors

chenxin185 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.