Better handling of clouds position

This commit is contained in:
Zukero
2018-03-23 16:56:47 +01:00
parent e594713a9b
commit a905d8b08a
2 changed files with 4 additions and 6 deletions

View File

@@ -171,17 +171,14 @@ public final class StartScreenActivity extends FragmentActivity implements OnNew
@Override
public boolean onPreDraw() {
float[] point = new float[]{0f,0f,0f,iv.getDrawable().getIntrinsicHeight()};
L.log("ANIM preDraw");
float[] point = new float[]{0f,0.25f * iv.getDrawable().getIntrinsicHeight()};
iv.getImageMatrix().mapPoints(point);
int imgY = (int) (iv.getTop() + point[1]);
L.log("ANIM imgY" + imgY);
int imgHeight = (int) (point[3] - point[1]);
L.log("ANIM imgHeight" + imgHeight);
int cloudSpace = (int) (imgY + (0.25 * imgHeight));
L.log("ANIM cloudSpace" + cloudSpace);
int screenHeight = getResources().getDisplayMetrics().heightPixels;
L.log("ANIM screenHeight" + screenHeight);
float maxY = ((float)cloudSpace) / ((float)screenHeight);
float maxY = ((float)imgY) / ((float)screenHeight);
L.log("ANIM maxY" + maxY);
if (clouds_back != null) {

View File

@@ -152,6 +152,7 @@ public class CloudsAnimatorView extends FrameLayout {
super.onWindowFocusChanged(hasWindowFocus);
if (hasWindowFocus) {
if (!started) {
L.log("ANIM focus start");
duration = (int) (DEFAULT_DURATION * getWidth() / (1024 * getResources().getDisplayMetrics().density));
startAnimation();
started = true;