Git Product home page Git Product logo

zerogravityanimation's Introduction

ZeroGravityAnimation

Make random object fly on your screen.

The repo helps in easier development of flying random objects on random directions (or on specific directions) to give a goodUI experience for the user. Specifically made for gaming purpose, the repo will be highly useful for apps that deals with space related animations, thus named as ZeroGravityAnimation. The animation works with a class called OverTheTopLayer, that makes the object to fly on the top of the screen. A ViewGroup layout can be passed optionally that acts as a container for the animating objects.

####Sample:

The image illustrates the stars flying beneath the earth with the help of container layout while a meteor and a satellite flying on the top of screen through OverTheTopLayer.

zero

####Usage:

int imgResource = R.drawable.star; // your animating object here
int count = 1;  // # of objects to fly
float scale = 0.2f; // scaling factor for the animating objects - value ranges from 0.0 to 1.0

// directions are optional and by default RANDOM will be picked
Direction origin = Direction.LEFT; // animation origin direction - can also use Direction.TOP, Direction.BOTTOM, Direction.LEFT or Direction.RANDOM
Direction destination = Direction.RIGHT; // same case as above for destination


ZeroGravityAnimation animation = new ZeroGravityAnimation();
animation.setCount(count);
animation.setScalingFactor(scale);
animation.setOriginationDirection(origin);
animation.setDestinationDirection(destination);
animation.setImage(resId);
animation.play(this);

#####Animation Listener: Default animation listener can used to collect events of this animation.

animation.setAnimationListener(new Animation.AnimationListener() {
                                           @Override
                                           public void onAnimationStart(Animation animation) {

                                           }

                                           @Override
                                           public void onAnimationEnd(Animation animation) {
                                          
                                           }

                                           @Override
                                           public void onAnimationRepeat(Animation animation) {

                                           }
                                       }
        );
```

#####Animation Object Container Specification:
Wanted you animation to take place beneath certain views - like the stars that fly beneath Earth in the above demo? 
Make sure you design your layouts to have a container layout (FrameLayout) that lies below than the original views and use the following code
    
```java
  
  ViewGroup container = (ViewGroup) findViewById(R.id.animation_container_layout); 
  animation.play(this,container);
```

###Apps using ZeroGravityAnimation:
[Goldhunt Game](https://play.google.com/store/apps/details?id=com.cooltechworks.goldhunt)|
------------ |
![goldhuntdemo](https://cloud.githubusercontent.com/assets/13122232/9293580/3521f486-444e-11e5-9de2-3b9cab9a13f6.gif)|




Developed By
============

* Harish Sridharan - <harish.sridhar@gmail.com>
  
        
       
        
        
        
      

zerogravityanimation's People

Contributors

sharish avatar

Watchers

Rahul yadav 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.