This commit is contained in:
Gangphon 2023-12-11 16:18:42 +08:00
parent a9994a3817
commit 67c9e8abd6

View File

@ -61,12 +61,17 @@ public class EleScroll extends View implements DrawOther, Choreographer.FrameCal
public void drawOther(Canvas canvas) {
if(img==null) return;
if(effect=='l') {
canvas.drawBitmap(img, cur, 0, null);
canvas.drawBitmap(img, cur+img.getWidth(), 0, null);
var x = cur;
do {
canvas.drawBitmap(img, x, 0, null);
x += img.getWidth();
} while(x < w);
} else if(effect=='r') {
var x = cur-img.getWidth()+w;
canvas.drawBitmap(img, x, 0, null);
canvas.drawBitmap(img, x-img.getWidth(), 0, null);
var x = cur + w - img.getWidth();
do {
canvas.drawBitmap(img, x, 0, null);
x -= img.getWidth();
} while(x > -img.getWidth());
} else if(effect=='t') {
canvas.drawBitmap(img, 0, cur, null);
canvas.drawBitmap(img, 0, cur+img.getHeight(), null);