mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
curl animation experiments
This commit is contained in:
parent
12742e935d
commit
cad2003092
1 changed files with 24 additions and 33 deletions
|
@ -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 {
|
y = - myScrollingShift;
|
||||||
myEdgePaint.setColor(ZLAndroidPaintContext.getFillColor());
|
x = y * w / h;
|
||||||
myEdgePaint.setAntiAlias(true);
|
}
|
||||||
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();
|
||||||
|
|
||||||
final Path path = new Path();
|
if (shift > 0 && shift < size) {
|
||||||
path.moveTo(Math.max(0, w - x * 4 / 3), h);
|
myEdgePaint.setColor(ZLAndroidPaintContext.getFillColor());
|
||||||
path.lineTo(w - x, h - y);
|
myEdgePaint.setAntiAlias(true);
|
||||||
path.lineTo(w, Math.max(0, h - y * 4 / 3));
|
myEdgePaint.setStyle(Paint.Style.FILL);
|
||||||
canvas.drawPath(path, myEdgePaint);
|
myEdgePaint.setShadowLayer(25, 5, 5, 0x99000000);
|
||||||
|
|
||||||
|
final Path path = new Path();
|
||||||
|
path.moveTo(Math.max(0, w - x * 4 / 3), h);
|
||||||
|
path.lineTo(w - x, h - y);
|
||||||
|
path.lineTo(w, Math.max(0, h - y * 4 / 3));
|
||||||
|
canvas.drawPath(path, myEdgePaint);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue