I have a ViewPager where I override onPageScrolled
to receive the amount a user has scrolled. I then need to flip a view according to the positionOffset
received from the scroll method. I want to achieve something like this. Flipping all views beside the selected one.
In my PageLayout
's onDraw
method I have the following code trying to skew the canvas according to the offset received.
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Matrix matrix = canvas.getMatrix();
camera.save();
camera.rotateX(skew);
camera.getMatrix(matrix);
camera.restore();
canvas.concat(matrix);
}
It looks like this only skewing the from the left:
How to I achieve the same effect from the right? Would be good if it not only skews it but also changing the height so it gives the illusion of being flipped slightly.