本文整理汇总了Java中org.piccolo2d.nodes.PPath.setOffset方法的典型用法代码示例。如果您正苦于以下问题:Java PPath.setOffset方法的具体用法?Java PPath.setOffset怎么用?Java PPath.setOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.piccolo2d.nodes.PPath
的用法示例。
在下文中一共展示了PPath.setOffset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drag
import org.piccolo2d.nodes.PPath; //导入方法依赖的package包/类
@Override
@SuppressWarnings({"unchecked"})
protected void drag(PInputEvent e) {
LOGGER.trace("Method drag("
+ e + ") called.");
PNode pickedNode = e.getPickedNode();
if (pickedNode instanceof PComposite) {
super.drag(e);
PComposite vNode = (PComposite) pickedNode;
/* Redraw edges */
ArrayList<PPath> vEdges = (ArrayList<PPath>) vNode.getAttribute("edges");
for (PPath vEdge : vEdges) {
mPanel.updateEdge(vEdge, (Position) vNode.getAttribute("position"));
}
/* TODO Redraw the shadow */
PPath vShadow = (PPath) vNode.getAttribute("glow");
if (vShadow != null) {
vShadow.setOffset(vNode.getOffset());
}
}
}
示例2: createRectNode
import org.piccolo2d.nodes.PPath; //导入方法依赖的package包/类
private void createRectNode(final int i) {
PPath path = PPath.createRectangle(0.0f, 0.0f, 50.0f * i/N + 10.0f, 50.0f * i/N + 10.0f);
int r = 200 * i/N + 45;
path.setPaint(new Color(r, 0, 0, 200));
path.setStrokePaint(new Color(r - 10, 0, 0, 200));
path.setOffset(random.nextDouble() * 1000.0d - random.nextDouble() * 1000.0,
random.nextDouble() * 1000.0d - random.nextDouble() * 1000.0);
getCanvas().getLayer().addChild(path);
}
示例3: buildRedRectangleNode
import org.piccolo2d.nodes.PPath; //导入方法依赖的package包/类
private PPath buildRedRectangleNode() {
PPath rectNode = PPath.createRectangle(0.0f, 0.0f, 75.0f, 75.0f);
rectNode.setPaint(Color.RED);
rectNode.setStroke(null);
rectNode.setOffset(25.0d, 325.0d);
return rectNode;
}
示例4: addGlow
import org.piccolo2d.nodes.PPath; //导入方法依赖的package包/类
private void addGlow(PComposite pNode, Color pHighlight) {
Point2D vPosition = pNode.getOffset();
PBounds vBound = pNode.getFullBoundsReference();
float vShadowWidth = (float) (1.1
* vBound.getWidth()
+ mGlowWidth);
float vShadowHeight = (float) (vBound.getHeight()
+ mGlowHeight);
PPath vShadow = PPath.createEllipse(-0.5F
* vShadowWidth, // x
-0.5F
* vShadowHeight, // y
vShadowWidth, // width
vShadowHeight // height
);
vShadow.setOffset((float) (vPosition.getX()), // x
(float) (vPosition.getY()) // y
);
vShadow.setStroke(null);
Color opaqueHighlight = new Color(pHighlight.getRed(),
pHighlight.getGreen(), pHighlight.getBlue(), 255);
Color transparentHighlight = new Color(pHighlight.getRed(),
pHighlight.getGreen(), pHighlight.getBlue(), 0);
vShadow.setPaint(ColorHelper.createGradientColor(new Piccolo2DGraphicWrapper(vShadow, null), opaqueHighlight,
transparentHighlight));
vShadow.setTransparency(0.0f);
synchronized (pNode) {
mLayerGlow.addChild(vShadow);
pNode.addAttribute("glow", vShadow);
}
vShadow.animateToTransparency(1.0f, 500); // TODO Use SettingManager
}