mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
This commit is contained in:
@@ -14,7 +14,6 @@ void setup() {
|
||||
size(640, 360);
|
||||
background(176);
|
||||
noStroke();
|
||||
smooth();
|
||||
int wideCount = width / unit;
|
||||
int highCount = height / unit;
|
||||
count = wideCount * highCount;
|
||||
|
||||
@@ -16,18 +16,23 @@
|
||||
* featured below.
|
||||
*/
|
||||
|
||||
// The next line is needed if running in JavaScript Mode with Processing.js
|
||||
/* @pjs font="Georgia.ttf"; */
|
||||
|
||||
char letter;
|
||||
String words = "Begin...";
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
// Create the font
|
||||
textFont(createFont("Georgia", 36));
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0); // Set background to black
|
||||
|
||||
// Draw the letter to the center of the screen
|
||||
textSize(12);
|
||||
textSize(14);
|
||||
text("Click on the program, then type to add to the String", 50, 50);
|
||||
text("Current key: " + letter, 50, 70);
|
||||
text("The String is " + words.length() + " characters long", 50, 90);
|
||||
|
||||
Binary file not shown.
@@ -6,11 +6,16 @@
|
||||
* to an equivalent representation within its datatype.
|
||||
* The conversion functions include int(), float(), char(), byte(), and others.
|
||||
*/
|
||||
|
||||
|
||||
// The next line is needed if running in JavaScript Mode with Processing.js
|
||||
/* @pjs font="Georgia.ttf"; */
|
||||
|
||||
size(640, 360);
|
||||
background(0);
|
||||
noStroke();
|
||||
|
||||
textFont(createFont("Georgia",24));
|
||||
|
||||
char c; // Chars are used for storing alphanumeric symbols
|
||||
float f; // Floats are decimal numbers
|
||||
int i; // Integers are values between 2,147,483,647 and -2147483648
|
||||
@@ -21,12 +26,11 @@ f = float(c); // Sets f = 65.0
|
||||
i = int(f * 1.4); // Sets i to 91
|
||||
b = byte(c / 2); // Sets b to 32
|
||||
|
||||
println(f);
|
||||
println(i);
|
||||
println(b);
|
||||
//println(f);
|
||||
//println(i);
|
||||
//println(b);
|
||||
|
||||
textSize(24);
|
||||
text("The value of c is " + c, 50, 100);
|
||||
text("The value of f is " + f, 50, 150);
|
||||
text("The value of i is " + i, 50, 200);
|
||||
text("The value of b is " + b, 50, 250);
|
||||
text("The value of variable c is " + c, 50, 100);
|
||||
text("The value of variable f is " + f, 50, 150);
|
||||
text("The value of variable i is " + i, 50, 200);
|
||||
text("The value of variable b is " + b, 50, 250);
|
||||
|
||||
@@ -11,7 +11,6 @@ void setup() {
|
||||
size(640, 360);
|
||||
stroke(255);
|
||||
noFill();
|
||||
smooth();
|
||||
}
|
||||
|
||||
void draw() {
|
||||
|
||||
@@ -19,7 +19,6 @@ color anchorPtCol = #BBBBBB;
|
||||
|
||||
void setup(){
|
||||
size(640, 360);
|
||||
smooth();
|
||||
setEllipse(pts, 65, 65);
|
||||
frameRate(1);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ float lastAngle = 0;
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(100);
|
||||
smooth();
|
||||
noStroke();
|
||||
diameter = min(width, height) * 0.75;
|
||||
noLoop(); // Run once and stop
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
size(640, 360);
|
||||
smooth();
|
||||
background(0);
|
||||
noStroke();
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ float innerRad;
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(204);
|
||||
smooth();
|
||||
x = width/2;
|
||||
y = height/2;
|
||||
outerRad = min(width, height) * 0.4;
|
||||
|
||||
@@ -17,7 +17,6 @@ float clockDiameter;
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
stroke(255);
|
||||
smooth();
|
||||
|
||||
int radius = min(width, height) / 2;
|
||||
secondsRadius = radius * 0.72;
|
||||
|
||||
@@ -15,7 +15,6 @@ int inner = edge + radius;
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
noStroke();
|
||||
smooth();
|
||||
ellipseMode(RADIUS);
|
||||
rectMode(CORNERS);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ float easing = 0.05;
|
||||
void setup()
|
||||
{
|
||||
size(640, 360);
|
||||
smooth();
|
||||
noStroke();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ float my[] = new float[num];
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
noStroke();
|
||||
fill(255, 153);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ void setup() {
|
||||
size(640, 360);
|
||||
frameRate(30);
|
||||
colorMode(RGB, 255, 255, 255, 100);
|
||||
smooth();
|
||||
w = width + 16;
|
||||
|
||||
for (int i = 0; i < maxwaves; i++) {
|
||||
|
||||
@@ -10,7 +10,6 @@ Eye e1, e2, e3;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
noStroke();
|
||||
e1 = new Eye( 250, 16, 120);
|
||||
e2 = new Eye( 164, 185, 80);
|
||||
|
||||
@@ -10,7 +10,6 @@ float max_distance;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
noStroke();
|
||||
max_distance = dist(0, 0, width, height);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ float xincrement = 0.01;
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(0);
|
||||
smooth();
|
||||
noStroke();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ float[] yvalues; // Using an array to store height values for the wave
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
colorMode(RGB,255,255,255,100);
|
||||
smooth();
|
||||
w = width+16;
|
||||
yvalues = new float[w/xspacing];
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ float theta_acc;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
|
||||
// Initialize all values
|
||||
r = height * 0.45;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
background(0);
|
||||
strokeWeight(20);
|
||||
frameRate(2);
|
||||
|
||||
@@ -11,7 +11,6 @@ void setup() {
|
||||
size(640, 360);
|
||||
diameter = height - 10;
|
||||
noStroke();
|
||||
smooth();
|
||||
noStroke();
|
||||
fill(255, 204, 0);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ float scalar = 70;
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
noStroke();
|
||||
smooth();
|
||||
rectMode(CENTER);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ float[] yvalues; // Using an array to store height values for the wave
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
w = width+16;
|
||||
dx = (TWO_PI / period) * xspacing;
|
||||
yvalues = new float[w/xspacing];
|
||||
|
||||
@@ -11,7 +11,6 @@ EggRing er1, er2;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
er1 = new EggRing(width*0.45, height*0.5, 0.1, 120);
|
||||
er2 = new EggRing(width*0.65, height*0.8, 0.05, 180);
|
||||
}
|
||||
|
||||
@@ -10,16 +10,13 @@
|
||||
SpinSpots spots;
|
||||
SpinArm arm;
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
arm = new SpinArm(width/2, height/2, 0.01);
|
||||
spots = new SpinSpots(width/2, height/2, -0.02, 90.0);
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
void draw() {
|
||||
background(204);
|
||||
arm.update();
|
||||
arm.display();
|
||||
@@ -27,8 +24,7 @@ void draw()
|
||||
spots.display();
|
||||
}
|
||||
|
||||
class Spin
|
||||
{
|
||||
class Spin {
|
||||
float x, y, speed;
|
||||
float angle = 0.0;
|
||||
Spin(float xpos, float ypos, float s) {
|
||||
@@ -41,8 +37,7 @@ class Spin
|
||||
}
|
||||
}
|
||||
|
||||
class SpinArm extends Spin
|
||||
{
|
||||
class SpinArm extends Spin {
|
||||
SpinArm(float x, float y, float s) {
|
||||
super(x, y, s);
|
||||
}
|
||||
@@ -58,8 +53,7 @@ class SpinArm extends Spin
|
||||
}
|
||||
}
|
||||
|
||||
class SpinSpots extends Spin
|
||||
{
|
||||
class SpinSpots extends Spin {
|
||||
float dim;
|
||||
SpinSpots(float x, float y, float s, float d) {
|
||||
super(x, y, s);
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
|
||||
Spot sp1, sp2;
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(204);
|
||||
smooth();
|
||||
noLoop();
|
||||
// Run the constructor without parameters
|
||||
sp1 = new Spot();
|
||||
|
||||
@@ -8,15 +8,13 @@
|
||||
* method turns it back on.
|
||||
*/
|
||||
|
||||
// @pjs preload must be used to preload media if the program is
|
||||
// running with Processing.js
|
||||
// The next line is needed if running in JavaScript Mode with Processing.js
|
||||
/* @pjs preload="bot1.svg"; */
|
||||
|
||||
PShape bot;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
// The file "bot1.svg" must be in the data folder
|
||||
// of the current sketch to load successfully
|
||||
bot = loadShape("bot1.svg");
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
* two new PShape objects by extracting the data from two states.
|
||||
*/
|
||||
|
||||
// @pjs preload must be used to preload media if the program is
|
||||
// running with Processing.js
|
||||
// The next line is needed if running in JavaScript Mode with Processing.js
|
||||
/* @pjs preload="usa-wikipedia.svg"; */
|
||||
|
||||
PShape usa;
|
||||
|
||||
@@ -8,15 +8,13 @@
|
||||
* it'll work for SVGs created with anything else.
|
||||
*/
|
||||
|
||||
// @pjs preload must be used to preload media if the program is
|
||||
// running with Processing.js
|
||||
// The next line is needed if running in JavaScript Mode with Processing.js
|
||||
/* @pjs preload="bot1.svg"; */
|
||||
|
||||
PShape bot;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
// The file "bot1.svg" must be in the data folder
|
||||
// of the current sketch to load successfully
|
||||
bot = loadShape("bot1.svg");
|
||||
|
||||
@@ -7,15 +7,13 @@
|
||||
* remain smooth at any size.
|
||||
*/
|
||||
|
||||
// @pjs preload must be used to preload media if the program is
|
||||
// running with Processing.js
|
||||
// The next line is needed if running in JavaScript Mode with Processing.js
|
||||
/* @pjs preload="bot1.svg"; */
|
||||
|
||||
PShape bot;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
// The file "bot1.svg" must be in the data folder
|
||||
// of the current sketch to load successfully
|
||||
bot = loadShape("bot1.svg");
|
||||
|
||||
@@ -12,7 +12,6 @@ PGraphics pg;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
pg = createGraphics(400, 200, P2D);
|
||||
}
|
||||
|
||||
@@ -24,7 +23,6 @@ void draw() {
|
||||
ellipse(mouseX, mouseY, 60, 60);
|
||||
|
||||
pg.beginDraw();
|
||||
pg.smooth();
|
||||
pg.background(51);
|
||||
pg.noFill();
|
||||
pg.stroke(255);
|
||||
|
||||
@@ -10,7 +10,6 @@ void setup() {
|
||||
size(640, 360);
|
||||
background(51);
|
||||
noStroke();
|
||||
smooth();
|
||||
noLoop();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
noStroke();
|
||||
smooth();
|
||||
noLoop();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ float segLength = 100;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
strokeWeight(30);
|
||||
stroke(255, 160);
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ float jitter;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
smooth();
|
||||
noStroke();
|
||||
fill(255);
|
||||
rectMode(CENTER);
|
||||
|
||||
@@ -5,18 +5,15 @@
|
||||
* setting the font, and then drawing the letters.
|
||||
*/
|
||||
|
||||
PFont fontA;
|
||||
// The next line is needed if running in JavaScript Mode with Processing.js
|
||||
/* @pjs font="Georgia.ttf"; */
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(0);
|
||||
smooth();
|
||||
|
||||
// Create the font
|
||||
fontA = createFont("Mono", 18);
|
||||
|
||||
// Set the font
|
||||
textFont(fontA);
|
||||
textFont(createFont("Georgia",24));
|
||||
textAlign(CENTER, CENTER);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,18 +1,20 @@
|
||||
/**
|
||||
* Words.
|
||||
*
|
||||
* The text() function is used for writing words to the screen.
|
||||
* The text() function is used for writing words to the screen.
|
||||
* The letters can be aligned left, center, or right with the
|
||||
* textAlign() function.
|
||||
*/
|
||||
|
||||
// The next line is needed if running in JavaScript Mode with Processing.js
|
||||
/* @pjs font="Georgia.ttf"; */
|
||||
|
||||
PFont fontA;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
|
||||
// Create the font
|
||||
fontA = createFont("Mono", 24);
|
||||
textFont(fontA, 24);
|
||||
textFont(createFont("Georgia", 24));
|
||||
}
|
||||
|
||||
void draw() {
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user