Giter Club home page Giter Club logo

gyroscopeimagedemo's Introduction

GyroscopeImageDemo

利用陀螺仪滑动图片的处理,以及针对陀螺仪图片控件的平滑转场动画。

我写了博客《陀螺仪图片控件 & 平滑转场动画的相关解析》,分享我的想法和思路。

欢迎讨论并提出您的宝贵建议。

Use GyroscopeImageView just like ImageView

在使用GyroscopeImageView控件时,若用 Picasso 加载图片 ,可利用 GyroscopeTransFormation, 传入控件的宽高即可合理地对图像尺寸做处理(当然你也可以自己处理图像的加载和图像的大小):

//用 Picasso加载图像 可将控件的宽高传入自定义的 TransFormation 来处理图像大小
Picasso.get()
    .load(picUrl)
    .transform(new GyroscopeTransFormation(width, height))
    .into(gyroscopeImageView);

Register the GyroscopeManager in related Activity

在相关ActivityonResumeonPause中对陀螺仪传感器进行注册和注销监听:

  @Override protected void onResume() {
    super.onResume();
    //利用我们的 GyroscopeManager 来注册传感器监听
    GyroscopeManager.getInstance().register(this);
  }

  @Override protected void onPause() {
    super.onPause();
    //利用我们的 GyroscopeManager 来注销监听
    GyroscopeManager.getInstance().unregister(this);
  }

Smoothly Transfer

平滑转场:

CoverActivity.startActivityWithAnimation(ImageMoveActivity.this, PIC_URL, gyroscopeImageView);

Found this project useful

❤️ Hope this article can help you. Support by clicking the ⭐, or share it with people around you. ❤️

About me

email : [email protected]

blog : jiangye

gyroscopeimagedemo's People

Contributors

jy39 avatar

Watchers

 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.