1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

curl animation experiments

This commit is contained in:
Nikolay Pultsin 2011-03-27 06:35:31 +01:00
parent 12742e935d
commit cad2003092

View file

@ -143,6 +143,8 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
final int size = horizontal ? w : h; final int size = horizontal ? w : h;
int shift = myScrollingShift < 0 ? myScrollingShift + size : myScrollingShift - size; int shift = myScrollingShift < 0 ? myScrollingShift + size : myScrollingShift - size;
switch (view.getAnimationType()) { switch (view.getAnimationType()) {
case none:
break;
case shift: case shift:
canvas.drawBitmap( canvas.drawBitmap(
mySecondaryBitmap, mySecondaryBitmap,
@ -152,14 +154,13 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
); );
break; break;
case slide: case slide:
case curl:
canvas.drawBitmap( canvas.drawBitmap(
mySecondaryBitmap, mySecondaryBitmap,
0, 0, 0, 0,
myPaint myPaint
); );
break; break;
case curl:
break;
} }
switch (view.getAnimationType()) { switch (view.getAnimationType()) {
case none: case none:
@ -191,32 +192,15 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
} }
break; break;
case curl: case curl:
if (shift <= 0) { {
canvas.drawBitmap( final int x, y;
mySecondaryBitmap, if (horizontal) {
0, 0, x = - myScrollingShift;
myPaint y = x * h / w;
);
} else { } else {
myEdgePaint.setColor(ZLAndroidPaintContext.getFillColor()); y = - myScrollingShift;
myEdgePaint.setAntiAlias(true); x = y * w / h;
myEdgePaint.setStyle(Paint.Style.FILL); }
myEdgePaint.setShadowLayer(25, 5, 5, 0x99000000);
final int x = w - shift;
final int y = x * h / w;
final Path bgPath = new Path();
bgPath.moveTo(Math.max(0, w - x * 4 / 3), h);
bgPath.lineTo(w, h);
bgPath.lineTo(w, Math.max(0, h - y * 4 / 3));
canvas.clipPath(bgPath);
canvas.drawBitmap(
mySecondaryBitmap,
0, 0,
myPaint
);
canvas.restore();
final Path fgPath = new Path(); final Path fgPath = new Path();
fgPath.moveTo(Math.max(0, w - x * 4 / 3), h); fgPath.moveTo(Math.max(0, w - x * 4 / 3), h);
@ -233,11 +217,18 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
); );
canvas.restore(); canvas.restore();
if (shift > 0 && shift < size) {
myEdgePaint.setColor(ZLAndroidPaintContext.getFillColor());
myEdgePaint.setAntiAlias(true);
myEdgePaint.setStyle(Paint.Style.FILL);
myEdgePaint.setShadowLayer(25, 5, 5, 0x99000000);
final Path path = new Path(); final Path path = new Path();
path.moveTo(Math.max(0, w - x * 4 / 3), h); path.moveTo(Math.max(0, w - x * 4 / 3), h);
path.lineTo(w - x, h - y); path.lineTo(w - x, h - y);
path.lineTo(w, Math.max(0, h - y * 4 / 3)); path.lineTo(w, Math.max(0, h - y * 4 / 3));
canvas.drawPath(path, myEdgePaint); canvas.drawPath(path, myEdgePaint);
}
break; break;
} }