i used to build a project using Processing 2.0b6,which displays some chinese characters and strings.it worked well in 2.0b6.
now i move to 2.0.3,but when i try to run that project in 2.0.3,it runs into problems.the chinese doesn't show up.it says"
no glyph found for XXX character".
all the icons are in different colors,but any one of them only has two colors,let's say,red and white.
When it's selected,it's itself.But when the icon is not select,it should be totally gray-scale,which means the red goes to gray but white stays white.And the whole icon shows a little transparency.
i have tried tint(gray,alpha),for example,tint(100,100),it turned out that the whole icon goes a little bit transparent,but the color is not right,the red goes more gray and dark but still looks red .More annoying,the white goes gray too!! I really don't want white to change.
How should i change the tint() to fulfill my idea??
Since my project is on Android,I don't want to put too many images into the project(it's now pretty large).So tint() must be used??Or any other method??
I first started a sketch by learning a example to draw four groups of circles that continuously changing the radius,and they follow the cursor.the following are my code:
Spring2D s1, s2, s3, s4;
float gravity = 0;
float mass = 5.0;
void setup()
{frameRate(30);
size(600, 600);
smooth();
fill(0);
// Inputs: x, y, mass, gravity
s1 = new Spring2D(0.0, width/2, mass, gravity);
s2 = new Spring2D(0.0, width/2, mass, gravity);
s3 = new Spring2D(0.0, width/2, mass, gravity);
s4 = new Spring2D(0.0, width/2, mass, gravity);
}
void draw()
{
background(150);
s1.update(mouseX, mouseY,0);
s1.display(mouseX, mouseY,0);
s2.update(s1.x, s1.y,15);
s2.display(s1.x, s1.y,15);
s3.update(s2.x, s2.y,30);
s3.display(s2.x, s2.y,30);
s4.update(s3.x, s3.y,45);
s4.display(s3.x, s3.y,45);
}
class Spring2D {
float vx, vy; // The x- and y-axis velocities
float x, y; // The x- and y-coordinates
float gravity;
float mass;
float radius = 80;
float stiffness = 0.2;
float damping = 0.7;
Spring2D(float xpos, float ypos, float m, float g) {
you may find the four groups move with certain acceleration.and then i wanted to get audio line in to control the radius of the circles.and i got the following:
import ddf.minim.*;
Minim minim;
AudioInput in;
void setup()
{
size(600, 600, P2D);
background(0);
smooth();
colorMode(HSB);
minim = new Minim(this);
minim.debugOn();
in = minim.getLineIn(Minim.STEREO, 10);
}
void draw()
{
fill(0,10);
strokeWeight(0);
rect(0,0,width,height);
for(int i = 0; i < in.bufferSize() - 1; i++)
{
float r=in.left.get(i);
Circle x=new Circle(mouseX,mouseY,r*2200);
x.display();
}
}
class Circle{
float x,y,ra;
Circle(float x1,float y1,float r1){
x=x1;
y=y1;
ra=r1;
}
void display(){
fill(random(0,255),255,255);
stroke(255);
strokeWeight(random(0,10));
ellipse(x-40,y-40,ra,ra);
}
}
void stop()
{
// always close Minim audio classes when you are done with them
in.close();
minim.stop();
super.stop();
}
but the circles appear along the movement of the cursor instead of four groups,and the acceleration is missing.so i tried the following:
import ddf.minim.*;
Minim minim;
AudioInput in;
void setup()
{
size(600, 600, P2D);
background(0);
smooth();
colorMode(HSB);
minim = new Minim(this);
minim.debugOn();
in = minim.getLineIn(Minim.STEREO, 10);
Circle x=new Circle(0,0,5);
}
void draw()
{
fill(0,10);
strokeWeight(0);
rect(0,0,width,height);
for(int i = 0; i < in.bufferSize() - 1; i++)
{
x.update(mouseX,mouseY);
x.display(in.left.get(i));
}
}
class Circle{
float x,y,ra,mass;
float stiffness = 0.2;
float damping = 0.7;
Circle(float x1,float y1,float m){
x=x1;
y=y1;
mass=m;
}
void update(float targetX, float targetY) {
float forceX = (targetX - x) * stiffness;
float ax = forceX / mass;
vx = damping * (vx + ax);
x += vx;
float forceY = (targetY - y) * stiffness;
float ay = forceY / mass;
vy = damping * (vy + ay);
y += vy;
}
void display(float r1){
ra=r1;
fill(random(0,255),255,255);
stroke(255);
strokeWeight(random(0,10));
ellipse(x-40,y-40,ra,ra);
}
}
void stop()
{
// always close Minim audio classes when you are done with them
in.close();
minim.stop();
super.stop();
}
But when running this code, it shows "The field component x is not visiable" on that red part.anyone know why??