Android ImageViews animated by Ken Burns Effect
KenBurnsView ============
Android library that provides an extension to ImageView that creates an immersive experience by animating its drawable using the [Ken Burns Effect][KenBurnsEffect].
![Example Image][SampleImage]
Overview
KenBurnsView provides the following advantages:
- Control: you can change the duration and the interpolator of transitions and
- Highly extensible: you can define how the rectangles to be zoomed
- Easy to use: you can start using it right away. All you need to do
[Changelog][Changelog]
Latest version: 1.0.7
- [Download JAR from Maven Central][Maven]
If you're using Gradle, you can declare this library as a dependency:
dependencies {
compile 'com.flaviofaria:kenburnsview:1.0.7'
}
Basic usage
For a working implementation, see the sample/ folder.
The simplest way to use KenBurnsView is by dropping the library JAR file into your project adding a view to an XML layout file:
<com.flaviofaria.kenburnsview.KenBurnsView
android:id="@+id/image"
android:layoutwidth="matchparent"
android:layoutheight="matchparent"
android:src="@drawable/your_drawable" />
Advanced usage
- You can set a listener to your view:
KenBurnsView kbv = (KenBurnsView) findViewById(R.id.image);
kbv.setTransitionListener(new TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
} @Override public void onTransitionEnd(Transition transition) {
} });
- You can pause the animation by calling
kbv.pause()and resume it
kbv.resume();
- You can change the duration and the interpolator of transitions:
RandomTransitionGenerator generator = new RandomTransitionGenerator(duration, interpolator);
kbv.setTransitionGenerator(generator);
- If you're willing to have even more control over transitions,
TransitionGenerator.
Questions
You can ask any question on Stack Overflow using the [android-kenburnsview][StackOverflowTag] tag.
License
[Apache Version 2.0][License]
[KenBurnsEffect]: http://en.wikipedia.org/wiki/KenBurnseffect [SampleImage]: anim.gif [Changelog]: https://github.com/flavioarfaria/KenBurnsView/wiki/Changelog [Maven]: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.flaviofaria%22%20AND%20a%3A%22kenburnsview%22 [StackOverflowTag]: http://stackoverflow.com/questions/tagged/android-kenburnsview [License]: http://www.apache.org/licenses/LICENSE-2.0.html