Code Monkey home page Code Monkey logo

android.arabicwheel's Introduction

Currently it's just a simple image rotating and scaling within it's view. But you could build up that image dynamically or even apply the same logic to the draw function of a container, but then I'm not sure if clicks would register correctly.

Features:

  • follow finger
  • fling wheel
  • come to standstill at center of a segment.
  • pinch to zoom zooms in on cut-off to a maximum of 2.5 times the window-height.
  • The wheel is always centered horizontally.
  • The wheel is centered vertically if smaller than the screen, otherwise the top is the top of the screen.

Method:

  • On finger-down the angle on the wheel is registered
  • On finger-move the new angle is determined and the wheel rotated the same amount of degrees.
  • On finger-up the angular speed between the last 2 events is determined and given to a runnable
    • the runnable calls itself every 14ms, moves the wheel based on elapsed time and velocity and then decreases the velocity.
    • As the speed drop below a certain value, the speed is adapted to the distance to the closest segment-center so it moves there.
    • If the distance to the closest segment-center is small enough it stops.
  • Touch events are also passed to a ScaleGestureDetector which recognises pinching and saves the new scale.

The showWheel creates a matrix that first does in order:

  • The scaling according to the scale factor.
  • The rotation around the center of the scaled image.
  • The translation to get the scaled image in the right position.

android.arabicwheel's People

Contributors

hampei avatar

Watchers

 avatar  avatar  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.