‘Selective’ Text Input

Hello, I would like some help with being able to have a user type a number and have it show on the screen and then maybe have the number stored so that It can be used else where. Example: Age, Date of Birth etc... I am newish to processing and have been dealing mostly with shapes and mouse functions. I would like to try something new. I have managed to find an example online and need some help adjusting it. https://amnonp5.wordpress.com/2012/01/28/25-life-saving-tips-for-processing/

String myText = "Type something"; void setup() { size(500, 500); textAlign(CENTER, CENTER); textSize(30); fill(0); } void draw() { background(255); text(myText, 0, 0, width, height); } void keyPressed() { if (keyCode == BACKSPACE) { if (myText.length() > 0) { myText = myText.substring(0, myText.length()-1); } } else if (keyCode != SHIFT && keyCode != CONTROL && keyCode != ALT) { myText = myText + key; } } 
submitted by /u/IanWasHere2002
[link] [comments]

Moving pictures

Hey guys, I've been working on an idea and I can't get it to work. The idea is the following: I have an array with an always constant size of 28800, which is exactly 48 * 640. It contains integers. Each integer stands for a type of png with a size of 64x64. I have gotten that far, I can create this array out of a picture the user provides. Now this is what I would like to happen: A kind of 2d "world" is created, where every integer in said array stands for one 64x64 block, going from left to right and up to bottom (the program knows which integer stands for which texture). I have two values, called x and y which change during the program. Now this 2d world created out of those integers, is supposed to be drawn every frame, if x and y are 0 and 0 it's drawn in the bottom, and the more the values grow, the more the blocks are moved to right/up. I know it's a pretty vague and difficult thing to achieve, and I really wouldn't want any of you to write too much code. Just pointing in the right direction would be more than enough, thanks very much in advance!

submitted by /u/the_42nd_reich
[link] [comments]

I’m new to processing and trying to get this old GitHub biomechanics simulation to work – can anyone help me out?

Hey everyone, I've been trying to get this Biomechanics GitHub code to work for a week now and I can't figure it out. It doesn't work even when I try using the old version of Processing (from 2011). I made a few fixes in order that it could run at all with one CSV file ("Animation"), but the one I really need to simulate ("walking_3d") is giving me a whole other set of problems. Can anyone please help me fix it so that it works with the current version? I would really deeply appreciate any help with this I've been working on it for so long!

submitted by /u/bmenbasics
[link] [comments]

Using old Processing code from 2012, need to rewrite sketch that used Applet

Hi everyone, I'm completely new to java and processing and I've been trying to troubleshoot an old GitHub code from 2012 that's supposed to animate a stick figure based on some gait data. The problem is that one of the sketches is heavily based on Applet code that is now fully deprecated, and the code won't even work in the old version of processing from 2011. Can anyone help me out? I'm so desperate I even tried contacting the original developer (he didn't respond) so any advice is really appreciated!

In the GitHub files, the problem sketch is called FrameController in the walking folder. This is it:

import java.awt.Rectangle; class FrameController { Comparison comparison; Rectangle playhead; Rectangle playarea; boolean playing = false; FrameController(PApplet p, Comparison comparison, int x, int y, int w) { this.comparison = comparison; playarea = new Rectangle(x,y, w,40); playhead = new Rectangle(0, 0, 5, 40); } void update() { if(playing){ comparison.nextFrame(); } float proportion = float(comparison.currentFrame) / comparison.totalFrames; float offset = playarea.width * proportion; playhead.x = int(offset); } void draw() { pushMatrix(); translate(playarea.x, playarea.y); //fill(240); noFill(); stroke(100); strokeWeight(0.5); rect(0, 0, playarea.width, playarea.height); int offset = phases.get(0).startingFrame; for (int i = 0; i < phases.size(); i++) { GaitPhase phase = phases.get(i); int phaseStartX = frameToX(phase.startingFrame - offset); int phaseStopX = frameToX(phase.endingFrame - offset); noStroke(); fill(phase.phaseColor()); rect(phaseStartX, 0, phaseStopX - phaseStartX, playarea.height); } fill(100); text("1", 0, 55); text(comparison.totalFrames, playarea.width - 20, 55); text(comparison.currentFrame + 1 + "/" + comparison.totalFrames, playarea.width/2 - 40, 55); fill(190); text("Play/Pause - spacebar Change FPS - +/- Previous Frame - left arrow Next Frame - right arrow Toggle 3d - d Toggle Rotation - r", playarea.width/2 - 360, 90); noStroke(); fill(0); rect(playhead.x, playhead.y, playhead.width, playhead.height); popMatrix(); } int frameToX(int _frame){ return int(map(_frame, 0, comparison.totalFrames, 0, playarea.width)); } int frameFromX(int _x) { return int(map(_x - playarea.x, 0, playarea.width, 0, comparison.totalFrames)); } void mousePressed() { if(playarea.contains(mouseX, mouseY)){ goToFrame(frameFromX(mouseX )); } } void mouseDragged(){ if(playarea.contains(mouseX, mouseY)){ goToFrame(frameFromX(mouseX)); } } void goToFrame(int frame) { if(frame >= comparison.totalFrames){ frame = 0; } if(frame < 0){ frame = comparison.totalFrames - 1; } comparison.currentFrame = frame; } void keyPressed() { if (key == CODED) { if (keyCode == LEFT) { goToFrame(comparison.currentFrame - 1); } if (keyCode == RIGHT) { goToFrame(comparison.currentFrame + 1); } } if(key == ' '){ playing = !playing; } } } 
submitted by /u/bmenbasics
[link] [comments]

Hi Guys, I’m new to Processing and trying to figure out a 32×32 grid for Fadecandy

Hey all, I'm trying to do this. It's a 32x32 zigzagging grid of ws2812's. I could really use some help getting a sketch going. I have not found too much to help me get started on anything other than an 8x8. I have a basic understanding of programming languages, so if you know of any references or know the code on this particular setup, please send them my way!

Thanks!

submitted by /u/killtheorcs
[link] [comments]

Loading PShapes, ArrayIndexOutOfBoundsException: 132 Constantly

Hello!

I've been trying to load some .svg's into an array to play with them and make a semi-randomized image. However, after I set up the loop to load the vectors into the array, I keep on receiving the 'ArrayIndexOutOfBoundsException: 132' error constantly.

The only thing that seems to fix it is keeping the PShape array to only 8 loaded shapes, as when the loop is set to load 9 it fails.

The error appears at line 23: letterSet[shp] = loadShape(shpName);

Code:

import processing.pdf.*; String fileName; String shpName; PShape[] letterSet = new PShape[26]; int ltr = 0; boolean exit = false; void setup(){ size(1920,1080); //noLoop(); noStroke(); colorMode(HSB,255,255,255); fileName = "TextureExport_"+year()+month()+day()+minute()+second()+".pdf"; for(int shp = 0; shp <= 25; shp++){ shpName = (shp+1) + ".svg"; letterSet[shp] = loadShape(shpName); } beginRecord(PDF, fileName); background(0); for(int x = 0; x <= width-1; x += width/16){ // Draws the grid background ------------ for(int y = 0; y <= height-1; y += height/9){ if(x >= width/2){ fill(random(20,128),255/2,random(128,255)); } else{ fill(random(128,235),255/2,random(128,255)); } rect(x,y,width/16,height/9); } } } void draw(){ shape(letterSet[ltr], mouseX, mouseY, 100, 100); if(exit == true){ endRecord(); exit(); } } void mousePressed(){ shape(letterSet[ltr], mouseX, mouseY, 100, 100); ltr+=1; } void keyPressed(){ if(key == ENTER){ exit = true; } } 

Thanks!

submitted by /u/blondofblargh
[link] [comments]

The State of Things 2017: experiments in perception


Justin Bennett, Multiplicity, 2017. Photo via Justin Bennett

If you ever find yourself in or around Brussels and are interested in art that explores technology in a meaningful way, then do visit the exhibition The State of Things 2017 at iMal, the center for digital cultures and technology.

The art center has invited Werktank and Overtoon to take over its galleries and present four installations developed by artists who work or have worked in their studios. Overtoon shows ‘Multiplicity’ by Justin Bennett and ‘Polyhedra’ by Floris Vanhoof. Werktank shows ‘The White’ by Kurt d’Haeseleer and Franck Vigroux, as well as ‘Search for the frame’ and two new site specific works by Johannes Langkamp.

Overtoon is based in Brussels and is dedicated to the research and production of sound art. Werktank is based in Leuven and produces installation art that explores the relationship between technology and perception. While the two platforms have different concerns, they both value an experimental and sensory approach to image, light and sound.

I’ve always have a soft spot for sound art so i’ll kick off my walk around the exhibition with the sound installations:


Floris Vanhoof, Polyhedra, 2017. Image courtesy of iMal


Floris Vanhoof, Polyhedra, 2017. Image courtesy of iMal


Floris Vanhoof, Polyhedra, 2017. Image courtesy of iMal

While at Overtoon, Floris Vanhoof created a symphonic orchestra composed of 40 loudspeakers of various geometrical shapes. Because they have different sizes, shapes and spatial placement, each sculpture translates sounds in a specific way. The listening experience takes on an additional visual but also sensorial dimension as you walk around and inside this cloud of speakers and discover how the natural movements in the sounds seem to morph and move from one sculpture to another.


Justin Bennett, Multiplicity, 2017. Image courtesy of iMal


Justin Bennett, Multiplicity, 2017. Image courtesy of iMal


Justin Bennett, Multiplicity (Filters for listening to the city), 2017


Justin Bennett, Multiplicity, 2017

During his residency at Overtoon, Justin Bennett built an array of listening devices -like a miniature microphone inside a trumpet or a wooden stethoscope- to explore the acoustic territories of Brussels. He then went on to uncover and record the voices and narratives of people, the sounds of work environments, of the fauna, of underground tunnels and passageways, etc. The artist manipulated the sounds he encountered, traced out narrative paths across the Belgian capital and explored the visual and spatial forms of the city in drawings and sculptures.

The exhibition detailed Bennett’s research into the sirens of emergency vehicles whose presence in Brussels’ soundscape increases with each terrorist threat or attack. The sound of various types of sirens and signals weaves into the urban fabric as they move through it. Bennett observed how the siren sounds bounce off the large glass facade of office buildings, giving the impression that there are several emergency vehicles instead of just one. And as the vehicle recedes into the distance, its direct noise fades out and leaves more space for its reflections which will, eventually, be covered by more powerful urban sounds.

The first result of Bennett’s research is a multi-trumpet sculptural installation that evokes the distorted and multiplied echoes produced by emergency sirens in urban space.

Kurt d’Haeseleer & Franck Vigroux, The White, 2017. Image courtesy of iMal


Kurt d’Haeseleer & Franck Vigroux, The White, 2017. Image courtesy of iMal


Kurt d’Haeseleer & Franck Vigroux, The White, 2017. Image courtesy of iMal


Kurt d’Haeseleer & Franck Vigroux, The White, 2017. Image courtesy of iMal

Kurt d’Haeseleer & Franck Vigroux‘s audiovisual installation recreates a technique that first appeared as a stage illusion in the mid-19th century. The Pepper’s ghost used a glass plate placed between spectators and the scene to create a ghost apparition on stage. The ghost was in fact an actor kept invisible for the public. In other cases, ghostly objects were made to ‘materialize’ then fade out of existence or to magically transform into different objects. The technique is still used nowadays in theatre, amusement parks, museums, television, and concerts. Teleprompters are a modern implementation of Pepper’s ghost. The technique was also used recently for the appearance of Tupac Shakur onstage with Dr. Dre and Snoop Dogg at the 2012 Coachella Festival and Michael Jackson at the 2014 Billboard Music Awards.

In ‘The White’, which was produced at Werktank, two white TV screens are reflected. The reflecting glass plate doesn’t show the expect white image but two eerie streams of moving images on each side of the plate.

The installation tries to poke into the dark subconscious part of our mind. It confronts us with both our fear and resistance for what is strange and unknown as our fascination and attraction to it. White, a color associated with positivity and goodness, seems to hide a more troubled and complex reality. The sensorial experience of ‘The White’ is somewhere between ecstasy and fear, like that of a child that hides his eyes from something horrible he sees, but still glimpses through his fingers to see what is happening.


Johannes Langkamp, Search for the frame, 2011-2016


Johannes Langkamp, Pyramid of Vision, 2017. Image courtesy of iMal


Johannes Langkamp, installation view at iMal. Image courtesy of iMal

Johannes Langkamp is fascinated by the way camera operates and the gap between reality and its representation. I think Langkamp’s research would deserves a proper interview. Until this happens, i’ll gaily copy/paste the press blurb: ‘Search for the frame’ is a selection of sixteen video sequences from Langkamp’s archive of video sketches from the past five years. The compilation is a cumulative view of his research in which he is experimenting with the possibilities of the framed look. By playing with the perspective, he shows how the camera can manipulate reality.

The artist also presents two new creations at iMAL, in which he continues his research: the video installation “Pyramid of Vision” and a spatial intervention, inspired by the location.

The State of Things 2017 is at iMal in Brussels until 15 October 2017.

Related stories: Experiments in sound and perception. An interview with Aernoudt Jacobs and Listen to the sounds from the deepest hole ever dug into the Earth crust.

Trying to get numbers on my axes as a scale but cant seem to manage. Code is added.

Table table; import java.util.Arrays; import hivis.common.*; import hivis.data.*; import java.util.*; void setup() { table = loadTable("largeNCHS.csv", "header"); int data_count = table.getRowCount(); float graph_scale = 200; float center_point = 200.0; size(900, 900); background(255, 255, 255); smooth(); // create an array of Correlation objects for each correlation set Correlation[] chol_vs_bps_dataset = new Correlation[data_count]; Correlation[] IncomeBracket_vs_SmokerAverage_dataset = new Correlation[6]; // populate the correlation sets int index = 0; for (TableRow row : table.rows()) { if(index <= 5){ int inc_brack = row.getInt("Income bracket"); float smok_avg = row.getFloat("Smoke average"); IncomeBracket_vs_SmokerAverage_dataset[index] = new Correlation(float(inc_brack), smok_avg); } int chol = row.getInt("chol"); int bps = row.getInt("bps"); chol_vs_bps_dataset[index] = new Correlation(bps, chol); index++; } // Sort chol_vs_bps_dataset by chol assending Arrays.sort(chol_vs_bps_dataset); // Create Tables for our correlation sets T chol_vs_bps_table = new T(chol_vs_bps_dataset, graph_scale, "Systolic blood pressure", "Chol", "Cholesterol Vs Sys-BP"); chol_vs_bps_table.draw(center_point+150, center_point+450); T IncomeBracket_vs_SmokerAverage_table = new T(IncomeBracket_vs_SmokerAverage_dataset, graph_scale, "Income Bracket", "Smoke %", "Income Bracket Vs Smoking %"); IncomeBracket_vs_SmokerAverage_table.draw(center_point+150, center_point+100); } class T { Correlation[] data_set; float max_y = +1.0; float max_x = -10000000.0; String x_axis_label; String y_axis_label; String title; float scale; T (Correlation[] data_set, float scale, String x_axis_label, String y_axis_label, String title) { this.data_set = data_set; this.scale = scale; this.title = title; this.x_axis_label = x_axis_label; this.y_axis_label = y_axis_label; // scope the data range for(Correlation c : this.data_set){ if(c.y > this.max_y){this.max_y = c.y;} if(c.x > this.max_x){this.max_x = c.x;} } } public void draw(float x, float y) { // set stroke weight and color for box strokeWeight(2.0); stroke(0, 0, 255); // draw box float min_y = y + 50; float max_y = min_y - this.scale - 100; float min_x = x - 50; float max_x = min_x + this.scale + 100; line(min_x, min_y, min_x, max_y); // left wall line(min_x, min_y, max_x, min_y); // bottom wall line(max_x, min_y, max_x, max_y); // right wall line(min_x, max_y, max_x, max_y); // top wall // reset stroke settings for graph strokeWeight(0.5); stroke(0, 0, 0); // draw y axis line(x, y, x, y - this.scale); // draw x axis line(x, y, x + this.scale, y); // labels textSize(10); fill(0, 0, 0); text(this.y_axis_label, x-45, y - this.scale/2.0); // y axis text(this.x_axis_label, x-50 + this.scale/2.0, y + 20); // x axis textSize(17); text(this.title, x - 100 + this.scale/2.0, y - this.scale - 10); // set stroke to red for graph line stroke(255, 0, 0); // min x point is x, max x point is x + scale. Correlation origin = new Correlation(x, y); Correlation previous_point = null; float index = 0.0; for( Correlation c : this.data_set ){ // calculate the ordinates for the correlation. float new_x = x + ((index/float(this.data_set.length))*this.scale); float new_y = y - ((c.y / this.max_y) * this.scale); // draw the ordinates from the previous point. if(previous_point != null){ line(previous_point.x, previous_point.y, new_x, new_y); } // set the new ordinates to be the previous for the next itteration. previous_point = new Correlation(new_x, new_y); index++; } } } class Correlation implements Comparable { float x, y; Correlation (float x, float y) { this.y = y; this.x = x; } int compareTo(Object o){ Correlation e = (Correlation)o; if(this.y < e.y){ return -1; } if( this.y > e.y) { return 1; } return 0; } } 
submitted by /u/halfcastaussie
[link] [comments]