return animateToTransform(at, millis);
/** * Animate this node's transform from its current location when the activity * starts to the specified location, scale, and rotation. If this node * descends from the root then the activity will be scheduled, else the * returned activity should be scheduled manually. If two different * transform activities are scheduled for the same node at the same time, * they will both be applied to the node, but the last one scheduled will be * applied last on each frame, so it will appear to have replaced the * original. Generally you will not want to do that. * * @param x the final target x position of node * @param y the final target y position of node * @param duration amount of time that the animation should take * @param scale the final scale for the duration * @param theta final theta value (in radians) for the animation * @return the newly scheduled activity */ public PTransformActivity animateToPositionScaleRotation(final double x, final double y, final double scale, final double theta, final long duration) { final PAffineTransform t = getTransform(); t.setOffset(x, y); t.setScale(scale); t.setRotation(theta); return animateToTransform(t, duration); }
/** * Animate this node from it's current transform when the activity starts a * new transform that will fit the node into the given bounds. If this node * descends from the root then the activity will be scheduled, else the * returned activity should be scheduled manually. If two different * transform activities are scheduled for the same node at the same time, * they will both be applied to the node, but the last one scheduled will be * applied last on each frame, so it will appear to have replaced the * original. Generally you will not want to do that. Note this method * animates the node's transform, but does not directly change the node's * bounds rectangle. Use animateToBounds() to animate the node's bounds * rectangle instead. * * @param x left of target bounds * @param y top of target bounds * @param width width of target bounds * @param height height of target bounds * @param duration amount of time that the animation should take * @return the newly scheduled activity */ public PTransformActivity animateTransformToBounds(final double x, final double y, final double width, final double height, final long duration) { final PAffineTransform t = new PAffineTransform(); t.setToScale(width / getWidth(), height / getHeight()); final double scale = t.getScale(); t.setOffset(x - getX() * scale, y - getY() * scale); return animateToTransform(t, duration); }