當前位置: 首頁>>代碼示例>>Java>>正文


Java PAffineTransform.scale方法代碼示例

本文整理匯總了Java中org.piccolo2d.util.PAffineTransform.scale方法的典型用法代碼示例。如果您正苦於以下問題:Java PAffineTransform.scale方法的具體用法?Java PAffineTransform.scale怎麽用?Java PAffineTransform.scale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.piccolo2d.util.PAffineTransform的用法示例。


在下文中一共展示了PAffineTransform.scale方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testScaleAboutPointWorksAsExpected

import org.piccolo2d.util.PAffineTransform; //導入方法依賴的package包/類
public void testScaleAboutPointWorksAsExpected() {
    node.setBounds(0, 0, 100, 100);
    node.scaleAboutPoint(2, new Point2D.Double(50, 50));
    final PAffineTransform expectedTransform = new PAffineTransform();
    expectedTransform.translate(-50, -50);
    expectedTransform.scale(2, 2);

    assertEquals(expectedTransform, node.getTransform());
}
 
開發者ID:piccolo2d,項目名稱:piccolo2d.java,代碼行數:10,代碼來源:PNodeTest.java


注:本文中的org.piccolo2d.util.PAffineTransform.scale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。