3

here is a nice gif of what happened in flicker app in the bottom this site Great animations with PageTransformer

here is what happening and i'm interested in:

1) first the fliker logo is large

2) by sliding next page the log scale down and move with nice animation

3) at the end the logo scale down and move to center and also the button moving up

i tried to achieve this kind of effect with ViewPager.PageTransformer. the problem is i can't control animation flow with amount of sliding. my animation start after a complete slid to next page.

i created a simple animation like these: (every time tried one of them)

XML

<scale
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:toXScale="0.3"
        android:toYScale="0.3"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="700"
        android:fillBefore="false" />

JAVA

TranslateAnimation trans = new TranslateAnimation(0, 0, logoText.getHeight() + coordinate[1], 0);
        trans.setDuration(1000);
        trans.setFillAfter(true);
        trans.setInterpolator(new AccelerateDecelerateInterpolator());

so how can i create effect like that gif?

mehdok
  • 1,499
  • 4
  • 29
  • 54
  • This Animation depends on the user swiping speed and direction, it does not make sense to apply a `TranslateAnimation`. As that post said "But we’re not limited to that view! We can also transform the views inside that view". Have you ever tried to manipulating the inner Views such as invoke the View.scrollTo(x, y) method in transformPage()? – VinceStyling Dec 31 '14 at 13:25
  • now i'm trying `PagerChangeListener` and in `onPageScrolled` i can play with `setScaleX` and `setScaleY` and `setTranslationX` and `setTranslationY` based on `positionOffset` value. it's kinda success and i created the similar effect. – mehdok Dec 31 '14 at 13:32
  • yes, i believe you're on track, it should work with `onPageScrolled`, I did such kind's effect before, code was post on [parallel-swipe-listview](https://github.com/vince-styling/parallel-swipe-listview), hope it can help. – VinceStyling Dec 31 '14 at 15:02

0 Answers0