processing

Processing Particle

放肆的年华 提交于 2019-12-13 05:51:36
问题 I've been trying to do something with this project I have but failed always so far :) so decided to ask here :) I want the particles to go around the ellipse from Rock class, not through it but around it, like a rock inside a river that water flows around it. Any suggestions ? int NUM_PARTICLES = 1000; ParticleSystem p; Rock r; void setup() { smooth(); fullScreen(P2D); //size(700,700,P2D); //background(0); p = new ParticleSystem(); r = new Rock(); } void draw() { background(0); p.update(); p

Badly formed character (expecting quote, got I) ~ Processing

守給你的承諾、 提交于 2019-12-13 04:42:17
问题 I hope someone can help me with my problem. I'm trying to make a simple visualization to show how soccer teams either moved up or down in the FIFA rankings for 2012. To that I have created and loaded 17 images to my sketch which I want to move based on a button event. Below is my code: //Setting up the images that will go into the sketch PImage img1; PImage img2; PImage img3; PImage img4; PImage img5; PImage img6; PImage img7; PImage img8; PImage img9; PImage img10; PImage img11; PImage img12

What processing library to use to create simultaneously running renders

淺唱寂寞╮ 提交于 2019-12-13 04:37:49
问题 I was recently working on processing (http://processing.org/) and was hoping to find out whether there is a library which would help me create two different windows which are rendering two views of the same scene. Also would there be any way to directly switch from one to another. 回答1: I don't know if such library exists for Processing, but you can easily create two windows using the following code based on a recent Processing forum thread import java.awt.Frame; import java.awt.MouseInfo;

Unfolding for processing 2.1 fails in JavaScript mode

拥有回忆 提交于 2019-12-13 04:36:06
问题 I downloaded the just released Unfolding Maps for Processing 2.1 and the examples work fine in Java mode but fail to run in the JavaScript mode. Is there anything which can be done to make them JavaScript mode compatible? The error I'm getting is uncaught exception: Processing.js: Unable to execute pjs sketch: ReferenceError: UnfoldingMap is not defined 回答1: The technology behind Processing and Processingjs is completely different. A library for Processing/ Java will not work with

How to correctly convert from rgb565 to rgb888

断了今生、忘了曾经 提交于 2019-12-13 04:27:39
问题 I'm trying to convert a value from rgb565 to rgb888 but I can't seem to get it right. I've also checked a few existing answers like this one but there are values that don't seem to be properly convert. Here's what I've tried so far: PImage picker; int c; void setup(){ size(285,240); picker = loadImage("hsv.gif"); int c = color(255,255,255); byte[] word = colorToWord(c); int[] rgb = wordToRGB(word); noStroke(); fill(c); rect(0,0,50,100); fill(rgb[0],rgb[1],rgb[2]); rect(50,0,50,100); } void

Make image disappear after X seconds (processing)

☆樱花仙子☆ 提交于 2019-12-13 03:26:26
问题 I'm currently working on a project in which I want an image to pop up after 3 seconds. Once that image has popped up the user has to click on the image to make a "done" image pop up that will disappear automatically after 3 seconds. I've got most of it working except for the disappearing part. Does anyone know how I can time the image to disappear after 3 seconds? PImage medic; PImage medicD; float time; float startTime; final int waitpopup = 3000; final int DISPLAY_DURATION = 3000; boolean

How to embed a PApplet in javafx?

﹥>﹥吖頭↗ 提交于 2019-12-13 03:04:32
问题 So I got my Processing code working in java. But now I want to embed it in JavaFX for my GUI. How can I do so? I tried using the following code but it does not seem to work. package testprocessing; import javafx.application.Application; import javafx.embed.swing.SwingNode; import javafx.scene.*; import javafx.scene.paint.Color; import javafx.stage.Stage; import javax.swing.JApplet; import javax.swing.SwingUtilities; import java.awt.Dimension; import java.util.concurrent.*; import processing

Over-riding the background() function in p5.js?

孤者浪人 提交于 2019-12-13 01:38:33
问题 I made a galaxy sketch in p5.js using rotates and radians, but it's erased each time the background() is loaded as draw() runs. Is there a way to over-ride the background() function? I want the galaxies to remain in view. var stars; function preload(){ //for (var i = 0; i < planetArray.length; i++) { //stars = loadImage('Assets/stars.png'); } function setup(){ createCanvas(windowWidth, windowHeight); } function draw() { //background(0); star() //function mousepressed(){ } function star(){ /

How to find certain items in an xml?

这一生的挚爱 提交于 2019-12-13 01:24:59
问题 I have an xml and all, and the good thing is, I can run it in processing. So when I press run, in the box in the bottom I get all the scores of all the teams. Why, here's the code: XML xml; void setup() { xml = loadXML("http://www.scorespro.com/rss2/live-basketball.xml"); XML[] channel = xml.getChildren("channel"); //println(xml); for (int i = 0; i < channel.length; i++) { String item = channel[i].getString("title"); String name = channel[i].getContent(); println(channel); } } Now I am

Adding import button to music player

隐身守侯 提交于 2019-12-13 00:57:32
问题 I'm trying to make it possible to make a functional import button, by this I mean I click the button, the file browser pops up and I can click a song then the player can play it. Just like any other music player. Here is a basic view of my code so far excluding the classes: import ddf.minim.spi.*; import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; import ddf.minim.ugens.*; boolean play; boolean repeat; int k; String filename;// Minim minim