I'm currently hosting my portfolio using Indexhibit, and I'd like to include a processing sketch on the main page using processing.js, although I'm not sure which index file to alter in order to get my sketch to show up. I'm also not sure where I should place the processing.js and .pde files, though I'm guessing they should go in the same folder as the index file I'm supposed to change.
Anyone else using Indexhibit who's had the same issue?
I'm trying to make a sketch that I created interact with links on my website but can't figure out if there's actually a way. Is there a sort of mouseHover function that I could use that would allow my sketch to react when the mouse hovers over a link?
I'm creating a project using a web cam in which the background is white, and movement that is detected is drawn as dark shapes. What I'm trying to do is generate audio when there are less white pixels on the screen (or more black pixels / movement). I've implemented an example from Processing which generates audio based on mouse location, but I was wondering how to map this audio to white pixels rather than mouse location, so that audio generates when there are less white pixels on screen.
Thanks for the help, and here's the example code (which I tweaked slightly):
EDIT: This is only the class code. If you wish to see the main code as well, which includes the setup() and draw() variables, I'd be happy to post that as well :)
// this signal uses the mouseX and mouseY position to build a signal
class Noise implements AudioSignal
{
void generate(float[] samp)
{
float range = map(mouseX, 0, width, 0, 1);
float peaks = map(mouseY, 0, height, 1, 20);
float inter = float(samp.length) / peaks;
for ( int i = 0; i < samp.length; i += inter )
{
for ( int j = 0; j < inter && (i+j) < samp.length; j++ )
I'm currently using the code I pulled form the OpenCV and website messing around and trying to understand blob detection. I applied a red stroke to the blob, but it seems that it is outlining everything around me, rather than myself. Does that mean that, technically, I'm NOT the blob? If so, how can I fix this?
Any help is greatly appreciated as I'm trying to understand this so I can implement it into a project I'm starting, which incorporates people as the blobs. For your convenience, here's the code to copy into Processing (as long as you have the OpenCV library):
import hypermedia.video.*;
OpenCV opencv;
void setup() {
size( 640, 480 );
// open video stream
opencv = new OpenCV( this );
opencv.capture( 640, 480 );
}
void draw() {
background(192);
opencv.read(); // grab frame from camera
opencv.threshold(100); // set black & white threshold
Just wondering if there was a way to simulate depth of field without using a camera.
I'm using OPENGL to render my sketch, and the object in the center of the sketch can be rotated, so I wasn't sure if I could simulate depth of field somehow so that when the object is rotated, it's slightly blurred behind a certain point.
Or, if blur's too intensive, I'd also be happy with just lightening up the stroke.
I'm trying to create a sketch that allows me to draw (which is actually an ArrayList of lines) and rotate my drawing around the Z-axis. However, as of right now, my Z-axis is located in the top-left corner of the sketch. I translated it to the center, but now when I draw in the center, my drawing actually appears in the bottom right.
I've tried subtracting width/2 and height/2 from where the lines are drawn, but that just screws up how the drawing appears.
Is there any relatively simple way to translate an axis location, and only the axis, without affecting anything else (or just some way to make this whole thing work)?
EDIT: Actually, after messing around, I'm curious as to how I can make every axis sit dead center (rather than on the left, top left, and top) without translating the location of my drawing.
I'm trying to create code that allows you to draw with the mouse (using pmouseX and pmouseY), although I want to create points along a 3D axis instead of a line.
By the time the code's finished, I'd like to be able to move a camera around the points to see what you've drawn, but in a 3D space.
Here's the example code for drawing a line using simple functions (it's rendering in P3D w/ lights() at the moment). Any easy way to turn that line into points? I also realize that there's the point() function, so I feel like that could possibly be part of the solution:
So I've been screwing around for the past couple of hours trying to create a single line that animates from point A to point B, which replicates a tree branch. I tried using a few different techniques, including noise(), to create the line's randomness, but wasn't successful.
Does anyone have a simple solution to creating a line that resembles a tree branch (a rather jagged / noisy line that tapers on one end)?
Thanks a ton for any help / ideas. They're honestly greatly appreciated.
Ultimately, I'm going to try to recreate the drawing tool used here:
I'm trying to make it so that the ellipse jumps to a random spot (within its constraints) when mouseX is within a certain location, although a new ellipse is generated every draw loop. I'm sure it's probably something simple that I'm missing, but is there some way to have it so that it only generates one ellipse when mouseX is within that section rather than one for every draw loop?
I think my question might be relatively simple, although I'm not quite sure where to begin coding what I'm trying to do.
I have an ellipse in the center of my sketch, and I basically want it to gradually decrease in size over time. I'm just not sure how to make the ellipse shrink, although I feel like I probably need to use a for loop? I'm still relatively new to Processing, so hopefully this'll come easier eventually.
Thanks for the help, and if you have any questions lemme know!
I'm trying to create a clock that, rather than displaying numbers, displays actual text. For example, the clock would display the number 1 as 'one'. My question is: what's the easiest way to go about making the text change every second? If I map my code to the specific time of day, is there a way to tell it to display words rather than numbers? Or should I actually type out the text and have it change every second and cycle back to 'one' after 60 seconds?
Let me know if you need me to clarify my question, and thanks for the help!
I have 2 .svg objects loaded up into a design, one on the left and one on the right. I'm trying to make it so that by LEFT clicking, I can drag on around the left object by itself, and same for the right. Currently, left clicking controls both simultaneously, and same with right clicking. I'm sure there's a way to get around this, but I'm not sure how.
Thanks for the help!
Here's the portion of my code that I'm trying to deal with: