- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 mac 上使用 Processing 2.08。我正在尝试使用文档中给出的 createShape 函数创建 PShape。
PShape s;
void setup(){
size(500,500);
s = createShape();
s.beginShape(QUADS);
s.fill(0);
s.vertex(100,100);
s.vertex(100,300);
s.vertex(300,300);
s.vertex(300,100);
s.endShape();
}
void draw(){
shape(s);
}
但是这个程序抛出 NullPointerException。在 Processing.org 论坛上查找时,我发现一个线程说新的处理库对此有问题。
引用:https://forum.processing.org/topic/changes-to-pshape-in-2-08
我如何使它起作用?有什么解决方法吗?谢谢
最佳答案
来自文档:
Datatype for storing shapes. Processing can currently load and display SVG (Scalable Vector Graphics) and OBJ shapes. Before a shape is used, it must be loaded with the loadShape() function. The shape() function is used to draw the shape to the display window. The PShape object contains a group of methods, linked below, that can operate on the shape data. OBJ files can only be opened using the P3D renderer.
您可以在此处找到引用:http://processing.org/reference/PShape.html
简而言之,目前,您必须先在别处创建形状才能使用 PShape。
您可以独立创建一个图像,将其保存在文件中,然后使用 PShape 加载它。这是一个 hack,但至少在他们想出更合适的修复之前,它可以使用 PShape。
关于nullpointerexception - PShape 2.08 使用 createShape 抛出 NullPointerException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16601675/
Processing 手册(第二版)中的示例 17-10 是这样的: PShape zig; void setup() { size(100, 100); zig = createShape(
我目前正在使用Processing构建一个应用程序。我有一个形状,我可以在其中选择其子元素并操纵其颜色和笔画...但我无法调整文件的每个元素的大小。基本上,我想要的是调整整个内容的大小,如下所示: s
我一直在编写一个程序,用不同的颜色重绘许多(数百个)相同的 PShape。但是,我还没有找到一种在不实际重新创建 PShape 的情况下以不同颜色重绘 PShape 的方法,即通过开始/结束形状重做所
我愿意: 多次平移、反转和旋转单个四边形(PShape 对象) 然后更改其 2 个顶部顶点之一的高度 因此整个物体就像一个铰接臂可以弯曲向右或向左。 为了尽可能清楚地说明,我制作了一些图形。
我有以下处理程序: //using Papplet instead of STDraw to visually represent my grid, created by Mahmed Ibrahim
我有这段代码基本上可以读取图像的每个像素并用不同的形状重新绘制它。使用 sin() wave 时所有形状都会变淡。现在我想在它们淡入时围绕其自己的轴 (shapeMode(CENTER)) 旋转每个“
我有这段代码基本上可以读取图像的每个像素并用不同的形状重新绘制它。使用 sin() wave 时所有形状都会变淡。现在我想在它们淡入时围绕其自己的轴 (shapeMode(CENTER)) 旋转每个“
我在 mac 上使用 Processing 2.08。我正在尝试使用文档中给出的 createShape 函数创建 PShape。 PShape s; void setup(){ size(500
我在 mac 上使用 Processing 2.08。我正在尝试使用文档中给出的 createShape 函数创建 PShape。 PShape s; void setup(){ size(500
我是一名优秀的程序员,十分优秀!