processing

代码本色+processing

好久不见. 提交于 2020-01-06 21:43:39
创意编程 实验要求 参考《代码本色》0-4章节,针对每个章节,编写5个习作。要求每个习作至少参考2个案例且必须有一定拓展。 本次作业按照规定要求认真学习书上相关内容,并运行浏览学习了每一段给出的范例代码。每一个习作都至少参考2个案例并且结合自己的想法加以拓展。 代码本色 第0章 引言 在这一章中介绍了随机和噪声,在书中介绍的原理我们看的很清楚,在随机游走的过程中有两种情况一个是有五种可能行走,一个是九种可能行走: 通过参考随机游走和噪声函数的学习我制作了一个可以随机游走且利用noise函数来实现颜色的变化: class Walker{ float x,y; float tx,ty; float r,b,g; float tr,tb,tg; Walker() { tx=0; ty=1000; tr=0; tb=200; tg=200; } void step() { x=map(noise(tx),0,1,0,width); y=map(noise(ty),0,1,0,height); tx+=0.01; ty+=0.01; } void c() //color { r=map(noise(tr),0,1,0,255); b=map(noise(tb),0,1,0,255); g=map(noise(tg),0,1,0,255); tr+=0.05; tb+=0.05; tg+=0

java.lang.NoClassDefFoundError: javax/media/opengl/GLException at processing.opengl.PGraphicsOpenGL

萝らか妹 提交于 2020-01-06 19:25:40
问题 I am writing a program in Processing on Raspberrypi(Raspbian), to import a 3D STL image file. It is working perfectly on Microsoft (windows7) & Linux(Ubuntu) platform but I am struggling to run same program on Raspberrypi (Raspbian) platform. I am getting below Error at size(600,600,P3D) when I run this program on Raspberrypi... Coding import toxi.geom.*; import toxi.geom.mesh.*; import toxi.processing.*; TriangleMesh mesh; ToxiclibsSupport gfx; void setup() { size(600,600,P3D); mesh=

java.lang.NoClassDefFoundError: javax/media/opengl/GLException at processing.opengl.PGraphicsOpenGL

我怕爱的太早我们不能终老 提交于 2020-01-06 19:25:07
问题 I am writing a program in Processing on Raspberrypi(Raspbian), to import a 3D STL image file. It is working perfectly on Microsoft (windows7) & Linux(Ubuntu) platform but I am struggling to run same program on Raspberrypi (Raspbian) platform. I am getting below Error at size(600,600,P3D) when I run this program on Raspberrypi... Coding import toxi.geom.*; import toxi.geom.mesh.*; import toxi.processing.*; TriangleMesh mesh; ToxiclibsSupport gfx; void setup() { size(600,600,P3D); mesh=

UnsatisfiedLinkError using Serial port from Processing in Eclipse

放肆的年华 提交于 2020-01-06 05:59:08
问题 I have a processing program that is supposed to read the data from a serial port created by an arduino uno. I got the program to work perfectly in Processing but not in Eclipse. I added core.jar serial.jar and jssc.jar to my java project's build path, but am still getting an error calling the port with Serial.list()[0] . I have seen similar questions on here, but none have helpful answers. I don't know if I'm missing something or need to import a different jar file to my build path. import

Why does this wobble?

纵然是瞬间 提交于 2020-01-06 05:09:05
问题 Tested on Processing 2.2.1 & 3.0a2 on OS X. The code I've tweaked below may look familiar to some of you, it's what Imgur now uses as their loading animation. It was posted on OpenProcessing.org and I've been able to get it working in Processing, but the arcs are constantly wobbling around (relative movement within 1 pixel). I'm new to Processing and I don't see anything in the sketch that could be causing this, it runs in ProcessingJS without issue (though very high CPU utilization). int num

How to run 'spacebrew' in “android mode” from processing?

旧街凉风 提交于 2020-01-06 01:55:09
问题 I am making an andriod app using 'andriod for processing lib" of processing (ie. running android mode in processing 2.0.3 and lauching it on my device). Spacebrew (http://docs.spacebrew.cc) is a easy to use web socket library for processing , also availabel as javascript. if i run the spacebrew example codes in andriod mode, the app gets launched in my device but doesnt show up in my spacebrew admin. whereas if i run the same thing in my mac, it shows up correctly. guess the websocket

Processing Code "Error, disabling_serialEvent() in Arduino

和自甴很熟 提交于 2020-01-05 09:26:35
问题 I receive this error when trying to run my arduino and Processing Error, disabling serialEvent() for /dev/cu.usbmodem1451 null I am running process 2 and Arduino 1.6.5 on a MAC OSX 10.9.5 I am super new to processing and arduino . I am just trying to use three potentiometers to control the RGB values of the background color. Arduino code: int potPin = 0; //int potPinB = 1; //int potPinC = 2; void setup() { Serial.begin(9600); } void loop() { int val = map(analogRead(potPin), 0, 1023, 0, 255);

Using Processing's loadImage in JavaScript

烈酒焚心 提交于 2020-01-05 07:41:49
问题 I am using the Processing API to draw an image to my HTML canvas, which I can use later in the code. The JavaScript code that I have is: var sketchProc = function(processingInstance) { with (processingInstance) { /* @pjs preload="images/hot-air.png" */ size(innerWidth, innerHeight); var testImage = loadImage("images/hot-air.png"); draw = function() { image(testImage, 0, 0, 500, 500); } } } var canvas = document.getElementById("canvas"); var processingInstance = new Processing(canvas,

Loading in folder outside of my sketch's data folder (processing)

送分小仙女□ 提交于 2020-01-05 04:08:25
问题 Im sure there is a pretty straight forward answer to this...cant quite figure it out though. In my processing sketch's data folder, there is a folder named test_segments. test_segments contains a bunch of images. I need to load an image from test_segments into my PImage. It looks like this: http://imgur.com/a/iG3B6 My code: final int len=25; final float thresh=170; boolean newDesign=false; PImage pic; ArrayList<PImage> imgContainer; int n=3; void setup() { size(800, 800, P2D); colorMode(RGB,

Arduino - Processing to save and display the data

白昼怎懂夜的黑 提交于 2020-01-05 04:07:08
问题 Code for my Arduino: #include<EngduinoThermistor.h> void setup() { Serial.begin(9600); EngduinoThermistor.begin(); }void loop() { float temp; temp = EngduinoThermistor.temperature(); Serial.println(temp); delay(1000); } Code for my Processing: import processing.serial.*; Serial port; float x = 0; void setup() { size(500, 400); println(Serial.list()); String portName = Serial.list()[0]; port = new Serial(this, "/dev/tty.usbmodem1411", 9600); } void draw() { } void serialEvent(Serial port) {