当前位置: 首页>>代码示例>>Java>>正文


Java PAffineTransform.rotate方法代码示例

本文整理汇总了Java中org.piccolo2d.util.PAffineTransform.rotate方法的典型用法代码示例。如果您正苦于以下问题:Java PAffineTransform.rotate方法的具体用法?Java PAffineTransform.rotate怎么用?Java PAffineTransform.rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.piccolo2d.util.PAffineTransform的用法示例。


在下文中一共展示了PAffineTransform.rotate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAnimateToPositionScaleRotationHasProperSetup

import org.piccolo2d.util.PAffineTransform; //导入方法依赖的package包/类
public void testAnimateToPositionScaleRotationHasProperSetup() {
    node.setBounds(0, 0, 100, 100);
    final PTransformActivity activity = node.animateToPositionScaleRotation(50, 50, 0.5, Math.PI, 50);

    assertEquals(50, activity.getDuration());
    assertEquals(PUtil.DEFAULT_ACTIVITY_STEP_RATE, activity.getStepRate());
    assertTrue(activity.getFirstLoop());
    assertFalse(activity.isStepping());

    final double[] resultTransform = activity.getDestinationTransform();

    final PAffineTransform expected = new PAffineTransform();
    expected.translate(50, 50);
    expected.scale(0.5, 0.5);
    expected.rotate(Math.PI);

    assertEquals(-0.5, resultTransform[0], 0.001);
    assertEquals(0, resultTransform[1], 0.001);
    assertEquals(0, resultTransform[2], 0.001);
    assertEquals(-0.5, resultTransform[3], 0.001);
    assertEquals(50.0, resultTransform[4], 0.001);
    assertEquals(50.0, resultTransform[5], 0.001);
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:24,代码来源:PNodeTest.java

示例2: testAnimateToPositionScaleRotationWithDuration0IsImmediate

import org.piccolo2d.util.PAffineTransform; //导入方法依赖的package包/类
public void testAnimateToPositionScaleRotationWithDuration0IsImmediate() {
    node.setBounds(0, 0, 100, 100);
    final PActivity activity = node.animateToPositionScaleRotation(50, 50, 0.5, Math.PI, 0);

    assertNull(activity);

    final PAffineTransform resultTransform = node.getTransform();

    final PAffineTransform expected = new PAffineTransform();
    expected.translate(50, 50);
    expected.scale(0.5, 0.5);
    expected.rotate(Math.PI);

    assertEquals(expected, resultTransform);
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:16,代码来源:PNodeTest.java

示例3: testRotateAboutPointVersion1AffectsTransformAsItShould

import org.piccolo2d.util.PAffineTransform; //导入方法依赖的package包/类
public void testRotateAboutPointVersion1AffectsTransformAsItShould() {
    node.setBounds(25, 25, 50, 50);
    node.rotateAboutPoint(Math.PI, 50, 0); // It's top center point

    final PAffineTransform expectedTransform = new PAffineTransform();
    expectedTransform.translate(100, 0);
    expectedTransform.rotate(Math.PI);

    assertEquals(expectedTransform, node.getTransform());
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:11,代码来源:PNodeTest.java

示例4: testRotateAboutPointVersion2AffectsTransformAsItShould

import org.piccolo2d.util.PAffineTransform; //导入方法依赖的package包/类
public void testRotateAboutPointVersion2AffectsTransformAsItShould() {
    node.setBounds(25, 25, 50, 50);
    node.rotateAboutPoint(Math.PI, new Point2D.Double(50, 0)); // It's top
    // center
    // point

    final PAffineTransform expectedTransform = new PAffineTransform();
    expectedTransform.translate(100, 0);
    expectedTransform.rotate(Math.PI);

    assertEquals(expectedTransform, node.getTransform());
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:13,代码来源:PNodeTest.java

示例5: testGetInverseTransformWorks

import org.piccolo2d.util.PAffineTransform; //导入方法依赖的package包/类
public void testGetInverseTransformWorks() {
    node.translate(50, 50);
    node.rotate(Math.PI);

    final PAffineTransform expectedTransform = new PAffineTransform();
    expectedTransform.rotate(-Math.PI);
    expectedTransform.translate(-50, -50);
    assertEquals(expectedTransform, node.getInverseTransform());
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:10,代码来源:PNodeTest.java


注:本文中的org.piccolo2d.util.PAffineTransform.rotate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。