javafx转换的当前圆圈位置 [英] Current circle position of javafx transition

查看:172
本文介绍了javafx转换的当前圆圈位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着找出转变中的下降圈当前的位置。我需要什么?每秒设定一个计时器。圆的位置?或任何建议如何获得真实的头寸价值。

im try to find out what current position my falling circle on transition have. What do i need for it? A timer to set each sec. the position of circle? Or any suggestion how to get the real position value.

此代码显示了我的hitOuterCirlce方法的一部分,甚至是相同的getCenterX - 圆圈的值:

This code shows a part of my hitOuterCirlce method and even the same getCenterX - value of the circle:

 // (x-u)*(x-u) + (y-v) )*(y-v) < (r * r)
    // outer circle:
    double u = 2 * (3.141 * circle.getRadius());
    double res1 = (circle.getCenterX() - u) * (circle.getCenterX() - u);
    double v = (1.333 * 3.141) * (circle.getRadius() * circle.getRadius()) * circle.getRadius();
    double res2 = (circle.getCenterY() - v) * (circle.getCenterY() - v);
    double res3 = (circle.getRadius() * circle.getRadius());

我该如何解决这个问题?

How can i fix this?

greetz

推荐答案

只需绑定到圆圈的centerX / Y属性

just bind to centerX/Y property of circle

示例代码:

DoubleProperty xValue = new SimpleDoubleProperty();
    xValue.bind(circle.centerXProperty());
    xValue.addListener(new ChangeListener() {
        @Override
        public void changed(ObservableValue arg0, Object arg1, Object arg2) {

            System.out.println(" Current center X : " + (double) arg2);
        }
    });

这篇关于javafx转换的当前圆圈位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆