欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

询问 Java 和 Android 路径动画

最编程 2024-04-28 22:45:08
...
代码语言:javascript
复制
 public void init(@Nullable AttributeSet attr) {
        circle = new Paint();
        circle.setColor(Color.GREEN);
        circle.setStyle(Paint.Style.FILL);
        circle.setAntiAlias(true);

        line = new Paint();
        line.setColor(Color.GREEN);
        line.setStyle(Paint.Style.STROKE);
        line.setStrokeWidth(10);
        line.setAntiAlias(true);


        Collections.addAll(height, 100, 20, 50, 40, 70, 10, 50); // in percent
        System.out.println(height.size() + " this is the size");
    }

    @Override
    protected void onDraw(Canvas canvas) {
        float y = getHeight() / 20 * 14;
        float x = getWidth() / 8;
        float radius = (canvas.getWidth() * canvas.getHeight()) / 40940;
        for (int c = 1; c < 8; c++) {
            System.out.println("at " + c);
            canvas.drawCircle(x * c, y - ((getHeight() / 20) * (height.get(c - 1) / 10)), radius, circle);
            points.add(new PointF(x * c, (y - ((getHeight() / 20) * (height.get(c - 1) / 10)))));
        }

    }

推荐阅读