Back to project page unknown-pleasures.
The source code is released under:
Creative Commons Attribution NonCommercial NoDerivs (CC-NC-ND) THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTE...
If you think the Android project unknown-pleasures listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/** * ScrollableOriginalCoverAnimator.java//from w ww . j av a 2s .c om * Author: marek.brodziak@gmail.com * Created: May 21, 2014 * Copyright 2014 by miniti */ package pl.miniti.android.pleasures.animation; import java.util.List; import android.graphics.Path; /** * Abstract {@see Animator} which offers support for basic scrollable animation */ public class ScrollableOriginalCoverAnimator implements Animator { /** * Collection of currently available paths */ protected List<Path> paths; /** * Current animation offset for calculating frames */ private int offset = 0; /** * Total number of lines */ private int total; /** * No-arg default constructor */ public ScrollableOriginalCoverAnimator() { paths = OriginalCover.paths(); } /* * (non-Javadoc) * * @see pl.miniti.android.pleasures.animation.Animator#of(int, int) */ @Override public Path of(int line, int of) { total = of; int index = line + offset; index = index >= of ? index - of : index; return paths.get(index); } /* * (non-Javadoc) * * @see pl.miniti.android.pleasures.animation.Animator#frame() */ @Override public void frame() { ++offset; if (offset >= total) { offset = 0; } } }