From 9a3380dee156d7d18feda71de2d7e21733276ae0 Mon Sep 17 00:00:00 2001 From: Makussu Date: Mon, 25 Sep 2023 18:56:08 +0200 Subject: [PATCH] done renaming --- .../Animationen_mit_Modulo.pde | 8 ++ .../Muster/Muster.pde | 19 +++ .../Muster_2/Muster_2.pde | 20 +++ .../Muster_3/Muster_3.pde | 14 ++ .../Muster_4/Muster_4.pde | 13 ++ .../Datentypen/Halbe_Pixel/Halbe_Pixel.pde | 8 ++ .../Mausposition_ausgeben.pde | 4 + .../Zeichenverkettung/Zeichenverkettung.pde | 11 ++ .../Interaktive_Linie.pde} | 0 .../Linie_und_Kreis.pde} | 0 .../Position_zur_Graustufe.pde} | 0 .../Quadrat_erscheinen_lassen.pde} | 0 .../Interaktion/Radiergummi/Radiergummi.pde | 1 + .../Rechteck_Ecke.pde} | 0 .../Symmetrische_Linie.pde} | 0 .../Wachsendes_Quadrat.pde} | 0 Lektion 1/Lokale_Variablen/Mitte/Mitte.pde | 15 ++ .../Lokale_Variablen/Zwillinge/Zwillinge.pde | 24 ++++ .../Syntax_und_Konventionen.pde | 61 ++++++++ Lektion 1/Systemvariablen/Mitte/Mitte.pde | 12 ++ Lektion 1/Systemvariablen/Zaehler/Zaehler.pde | 23 +++ .../Zeichen_Ticker/Zeichen_Ticker.pde | 13 ++ Lektion 1/Text-Ausgabe/Ecken/Ecken.pde | 19 +++ .../TextMauszeiger/TextMauszeiger.pde | 11 ++ .../Text_mit_Schatten/Text_mit_Schatten.pde | 8 ++ .../Schwarz_weiss_rechteck.pde} | 0 Lektion 1/Zeichnen/Stern/Stern.pde | 22 ++- .../Stern_abgebe_version.pde | 24 ---- scratch/ArithmetischeOperatoren.pde | 72 ++++++++++ scratch/Datentypen.pde | 32 +++++ scratch/Stern/Stern.pde | 16 +++ .../Lektion_1_LokaleUndSystemvariablen.pde | 135 ++++++++++++++++++ .../lokalesystemvariablen.pde | 0 33 files changed, 554 insertions(+), 31 deletions(-) create mode 100644 Lektion 1/Arithmetische_Operatoren/Animationen_mit_Modulo/Animationen_mit_Modulo.pde create mode 100644 Lektion 1/Arithmetische_Operatoren/Muster/Muster.pde create mode 100644 Lektion 1/Arithmetische_Operatoren/Muster_2/Muster_2.pde create mode 100644 Lektion 1/Arithmetische_Operatoren/Muster_3/Muster_3.pde create mode 100644 Lektion 1/Arithmetische_Operatoren/Muster_4/Muster_4.pde create mode 100644 Lektion 1/Datentypen/Halbe_Pixel/Halbe_Pixel.pde create mode 100644 Lektion 1/Datentypen/Mausposition_ausgeben/Mausposition_ausgeben.pde create mode 100644 Lektion 1/Datentypen/Zeichenverkettung/Zeichenverkettung.pde rename Lektion 1/Interaktion/{Interaktive Linie/Interaktive Linie.pde => Interaktive_Linie/Interaktive_Linie.pde} (100%) rename Lektion 1/Interaktion/{Linie und Kreis/Linie und Kreis.pde => Linie_und_Kreis/Linie_und_Kreis.pde} (100%) rename Lektion 1/Interaktion/{Position zur Graustufe/Position zur Graustufe.pde => Position_zur_Graustufe/Position_zur_Graustufe.pde} (100%) rename Lektion 1/Interaktion/{Quadrat erscheinen lassen/Quadrat erscheinen lassen.pde => Quadrat_erscheinen_lassen/Quadrat_erscheinen_lassen.pde} (100%) rename Lektion 1/Interaktion/{Rechteck-Ecke/Rechteck-Ecke.pde => Rechteck_Ecke/Rechteck_Ecke.pde} (100%) rename Lektion 1/Interaktion/{Symmetrische Linie/Symmetrische Linie.pde => Symmetrische_Linie/Symmetrische_Linie.pde} (100%) rename Lektion 1/Interaktion/{Wachsendes Quadrat/Wachsendes Quadrat.pde => Wachsendes_Quadrat/Wachsendes_Quadrat.pde} (100%) create mode 100644 Lektion 1/Lokale_Variablen/Mitte/Mitte.pde create mode 100644 Lektion 1/Lokale_Variablen/Zwillinge/Zwillinge.pde create mode 100644 Lektion 1/Syntax_und_Konventionen/Syntax_und_Konventionen.pde create mode 100644 Lektion 1/Systemvariablen/Mitte/Mitte.pde create mode 100644 Lektion 1/Systemvariablen/Zaehler/Zaehler.pde create mode 100644 Lektion 1/Systemvariablen/Zeichen_Ticker/Zeichen_Ticker.pde create mode 100644 Lektion 1/Text-Ausgabe/Ecken/Ecken.pde create mode 100644 Lektion 1/Text-Ausgabe/TextMauszeiger/TextMauszeiger.pde create mode 100644 Lektion 1/Text-Ausgabe/Text_mit_Schatten/Text_mit_Schatten.pde rename Lektion 1/Zeichnen/{Schwarz_wei__rechteck/Schwarz_wei__rechteck.pde => Schwarz_weiss_rechteck/Schwarz_weiss_rechteck.pde} (100%) delete mode 100644 Lektion 1/Zeichnen/Stern_abgebe_version/Stern_abgebe_version.pde create mode 100644 scratch/ArithmetischeOperatoren.pde create mode 100644 scratch/Datentypen.pde create mode 100644 scratch/Stern/Stern.pde create mode 100644 scratch/lokale und systemvariablen/Lektion_1_LokaleUndSystemvariablen.pde rename {lokalesystemvariablen => scratch/lokalesystemvariablen}/lokalesystemvariablen.pde (100%) diff --git a/Lektion 1/Arithmetische_Operatoren/Animationen_mit_Modulo/Animationen_mit_Modulo.pde b/Lektion 1/Arithmetische_Operatoren/Animationen_mit_Modulo/Animationen_mit_Modulo.pde new file mode 100644 index 0000000..0c960e0 --- /dev/null +++ b/Lektion 1/Arithmetische_Operatoren/Animationen_mit_Modulo/Animationen_mit_Modulo.pde @@ -0,0 +1,8 @@ +void setup() { + size(800, 600); +} + +void draw() { + background(200); + ellipse(frameCount%width, 300, 100, 100); +} diff --git a/Lektion 1/Arithmetische_Operatoren/Muster/Muster.pde b/Lektion 1/Arithmetische_Operatoren/Muster/Muster.pde new file mode 100644 index 0000000..4f2955e --- /dev/null +++ b/Lektion 1/Arithmetische_Operatoren/Muster/Muster.pde @@ -0,0 +1,19 @@ +void setup() { + size(800, 600); +} +int x = 0; +float y = 0; + +void draw() { + if (x % 3 == 0) { + stroke(0); + } else if (x % 3 == 1) { + stroke(150); + } else { + stroke(230); + } + + line(x, 0, x, y); + x+= 1; + y+= 0.5; +} diff --git a/Lektion 1/Arithmetische_Operatoren/Muster_2/Muster_2.pde b/Lektion 1/Arithmetische_Operatoren/Muster_2/Muster_2.pde new file mode 100644 index 0000000..9e2e18b --- /dev/null +++ b/Lektion 1/Arithmetische_Operatoren/Muster_2/Muster_2.pde @@ -0,0 +1,20 @@ +void setup() { + size(800, 600); +} + +int x = 0; +int y = 0; + +void draw() { + if (x % 3 == 0) { + stroke(0); + } else if (x % 3 == 1) { + stroke(150); + } else { + stroke(230); + } + + line(x, 0, x, y); + x+= 1; + y+= 1; +} diff --git a/Lektion 1/Arithmetische_Operatoren/Muster_3/Muster_3.pde b/Lektion 1/Arithmetische_Operatoren/Muster_3/Muster_3.pde new file mode 100644 index 0000000..9bae357 --- /dev/null +++ b/Lektion 1/Arithmetische_Operatoren/Muster_3/Muster_3.pde @@ -0,0 +1,14 @@ +int x = 0; +int y = 0; + +void setup() { + size(800, 600); + + y = height; +} + +void draw() { + line(x, 0, x, y); + x+= 1; + y-= 1; +} diff --git a/Lektion 1/Arithmetische_Operatoren/Muster_4/Muster_4.pde b/Lektion 1/Arithmetische_Operatoren/Muster_4/Muster_4.pde new file mode 100644 index 0000000..4a59b73 --- /dev/null +++ b/Lektion 1/Arithmetische_Operatoren/Muster_4/Muster_4.pde @@ -0,0 +1,13 @@ +void setup() { + size(800, 600); +} + +int x = 0; +int y = 0; + +void draw() { + stroke(x / (width / 255)); + line(x, 0, x, y); + x+= 1; + y+= 1; +} diff --git a/Lektion 1/Datentypen/Halbe_Pixel/Halbe_Pixel.pde b/Lektion 1/Datentypen/Halbe_Pixel/Halbe_Pixel.pde new file mode 100644 index 0000000..322e0b4 --- /dev/null +++ b/Lektion 1/Datentypen/Halbe_Pixel/Halbe_Pixel.pde @@ -0,0 +1,8 @@ +// Der Kreis wandert alleine nach rechts +float x = 0; + +void draw() { + background(255); + x+=0.5; + ellipse(x, 50, 30, 30); +} diff --git a/Lektion 1/Datentypen/Mausposition_ausgeben/Mausposition_ausgeben.pde b/Lektion 1/Datentypen/Mausposition_ausgeben/Mausposition_ausgeben.pde new file mode 100644 index 0000000..376ab9a --- /dev/null +++ b/Lektion 1/Datentypen/Mausposition_ausgeben/Mausposition_ausgeben.pde @@ -0,0 +1,4 @@ +void draw() { + frameRate(10); + println("x=" + mouseX + " y=" + mouseX); +} diff --git a/Lektion 1/Datentypen/Zeichenverkettung/Zeichenverkettung.pde b/Lektion 1/Datentypen/Zeichenverkettung/Zeichenverkettung.pde new file mode 100644 index 0000000..c219997 --- /dev/null +++ b/Lektion 1/Datentypen/Zeichenverkettung/Zeichenverkettung.pde @@ -0,0 +1,11 @@ +String message = "la"; + +void setup() { + size(800, 600); +} + +void draw() { + frameRate(10); + println(message); + message += " la"; +} diff --git a/Lektion 1/Interaktion/Interaktive Linie/Interaktive Linie.pde b/Lektion 1/Interaktion/Interaktive_Linie/Interaktive_Linie.pde similarity index 100% rename from Lektion 1/Interaktion/Interaktive Linie/Interaktive Linie.pde rename to Lektion 1/Interaktion/Interaktive_Linie/Interaktive_Linie.pde diff --git a/Lektion 1/Interaktion/Linie und Kreis/Linie und Kreis.pde b/Lektion 1/Interaktion/Linie_und_Kreis/Linie_und_Kreis.pde similarity index 100% rename from Lektion 1/Interaktion/Linie und Kreis/Linie und Kreis.pde rename to Lektion 1/Interaktion/Linie_und_Kreis/Linie_und_Kreis.pde diff --git a/Lektion 1/Interaktion/Position zur Graustufe/Position zur Graustufe.pde b/Lektion 1/Interaktion/Position_zur_Graustufe/Position_zur_Graustufe.pde similarity index 100% rename from Lektion 1/Interaktion/Position zur Graustufe/Position zur Graustufe.pde rename to Lektion 1/Interaktion/Position_zur_Graustufe/Position_zur_Graustufe.pde diff --git a/Lektion 1/Interaktion/Quadrat erscheinen lassen/Quadrat erscheinen lassen.pde b/Lektion 1/Interaktion/Quadrat_erscheinen_lassen/Quadrat_erscheinen_lassen.pde similarity index 100% rename from Lektion 1/Interaktion/Quadrat erscheinen lassen/Quadrat erscheinen lassen.pde rename to Lektion 1/Interaktion/Quadrat_erscheinen_lassen/Quadrat_erscheinen_lassen.pde diff --git a/Lektion 1/Interaktion/Radiergummi/Radiergummi.pde b/Lektion 1/Interaktion/Radiergummi/Radiergummi.pde index 04f9e1a..f7b7ea0 100644 --- a/Lektion 1/Interaktion/Radiergummi/Radiergummi.pde +++ b/Lektion 1/Interaktion/Radiergummi/Radiergummi.pde @@ -1,3 +1,4 @@ +void setup() { size(200, 200); background(255); // Viereck in der mitte diff --git a/Lektion 1/Interaktion/Rechteck-Ecke/Rechteck-Ecke.pde b/Lektion 1/Interaktion/Rechteck_Ecke/Rechteck_Ecke.pde similarity index 100% rename from Lektion 1/Interaktion/Rechteck-Ecke/Rechteck-Ecke.pde rename to Lektion 1/Interaktion/Rechteck_Ecke/Rechteck_Ecke.pde diff --git a/Lektion 1/Interaktion/Symmetrische Linie/Symmetrische Linie.pde b/Lektion 1/Interaktion/Symmetrische_Linie/Symmetrische_Linie.pde similarity index 100% rename from Lektion 1/Interaktion/Symmetrische Linie/Symmetrische Linie.pde rename to Lektion 1/Interaktion/Symmetrische_Linie/Symmetrische_Linie.pde diff --git a/Lektion 1/Interaktion/Wachsendes Quadrat/Wachsendes Quadrat.pde b/Lektion 1/Interaktion/Wachsendes_Quadrat/Wachsendes_Quadrat.pde similarity index 100% rename from Lektion 1/Interaktion/Wachsendes Quadrat/Wachsendes Quadrat.pde rename to Lektion 1/Interaktion/Wachsendes_Quadrat/Wachsendes_Quadrat.pde diff --git a/Lektion 1/Lokale_Variablen/Mitte/Mitte.pde b/Lektion 1/Lokale_Variablen/Mitte/Mitte.pde new file mode 100644 index 0000000..a0f9252 --- /dev/null +++ b/Lektion 1/Lokale_Variablen/Mitte/Mitte.pde @@ -0,0 +1,15 @@ +void setup() +{ + size(800, 600); +} +void draw() +{ + // Clear Background to prevent shadows + background(40, 40, 40, 256); + + + line(0, 0, mouseX, mouseY); + + circle(mouseX, mouseY, 10); + circle(mouseX * .5, mouseY * .5, 10); +} diff --git a/Lektion 1/Lokale_Variablen/Zwillinge/Zwillinge.pde b/Lektion 1/Lokale_Variablen/Zwillinge/Zwillinge.pde new file mode 100644 index 0000000..1f14bc8 --- /dev/null +++ b/Lektion 1/Lokale_Variablen/Zwillinge/Zwillinge.pde @@ -0,0 +1,24 @@ +void setup() +{ + size(800, 600); +} +void draw() +{ + // Clear Background to prevent shadows + background(40, 40, 40, 256); + + //First circle + fill(0, 50, 256); + circle(mouseX, mouseY, 100); + + // Second circle + // project mouse pos between 0 and 1. Take inverse to get the point symmetric postion + PVector fitMouse = new PVector((float) mouseX / (float) width, (float) mouseY / (float) height); + PVector twinPos = new PVector((1.0f - fitMouse.x) * width, (1.0f - fitMouse.y) * height); + + fill(256, 50, 0); + circle(twinPos.x, twinPos.y, 100); + + + //println(fitMouseX + ", " + inverseMouseX ); +} diff --git a/Lektion 1/Syntax_und_Konventionen/Syntax_und_Konventionen.pde b/Lektion 1/Syntax_und_Konventionen/Syntax_und_Konventionen.pde new file mode 100644 index 0000000..b28ed1b --- /dev/null +++ b/Lektion 1/Syntax_und_Konventionen/Syntax_und_Konventionen.pde @@ -0,0 +1,61 @@ +final int SPEED = 3; +final int RADIUS = 10; + +boolean left1 = true; +boolean left2 = true; +boolean left3 = true; + +float x1 = random(50, width-50); +float x2 = random(50, width-50); +float x3 = random(50, width-50); + +void setup () { + size(200, 200); +} + +// move balls +void moveballs() { + if (x1+RADIUS>width) { + left1=true; + } + if (x1-RADIUS<0) { + left1=false; + } + if (left1) { + x1-=SPEED; + } else { + x1+=SPEED; + } + if (x2+RADIUS>width) { + left2=true; + } + if (x2-RADIUS<0) { + left2=false; + } + if (left2) { + x2-=SPEED; + } else { + x2+=SPEED; + } + if (x3+RADIUS>width) { + left3=true; + } + if (x3-RADIUS<0) { + left3=false; + } + if (left3) { + x3-=SPEED; + } else { + x3+=SPEED; + } +} + +void draw() { + background(50); + fill(200, 50, 50); + + ellipse(x1, width*0.25, RADIUS*2, RADIUS*2); + ellipse(x2, width*0.5, RADIUS*2, RADIUS*2); + ellipse(x3, width*0.75, RADIUS*2, RADIUS*2); + moveballs(); +} diff --git a/Lektion 1/Systemvariablen/Mitte/Mitte.pde b/Lektion 1/Systemvariablen/Mitte/Mitte.pde new file mode 100644 index 0000000..9069e8d --- /dev/null +++ b/Lektion 1/Systemvariablen/Mitte/Mitte.pde @@ -0,0 +1,12 @@ +void setup() +{ + size(111, 77); + surface.setResizable(true); +} +void draw() +{ + // Beim übertragen richtige Fenstergröße (111 x 77) in die main (setup) Methode eintragen und surface.setResizable(true) setzen + background(40, 40, 40, 256); + circle(width/2, height/2,50); + +} diff --git a/Lektion 1/Systemvariablen/Zaehler/Zaehler.pde b/Lektion 1/Systemvariablen/Zaehler/Zaehler.pde new file mode 100644 index 0000000..865b700 --- /dev/null +++ b/Lektion 1/Systemvariablen/Zaehler/Zaehler.pde @@ -0,0 +1,23 @@ +void setup() +{ + size(800, 600); + frameRate(60); +} +float second; +float offset = 0; + +void draw() +{ + background(40, 40, 40, 256); + //fill(0,0,0,1); + second = constrain(((float) frameCount / (float) frameRate) - offset, 0 , 1000); + + if(mousePressed == true) + { + offset = second + offset ; + } + + println(offset + " " + mousePressed); + textSize(50); + text(second, width / 2 -50, height/2); +} diff --git a/Lektion 1/Systemvariablen/Zeichen_Ticker/Zeichen_Ticker.pde b/Lektion 1/Systemvariablen/Zeichen_Ticker/Zeichen_Ticker.pde new file mode 100644 index 0000000..45d4de3 --- /dev/null +++ b/Lektion 1/Systemvariablen/Zeichen_Ticker/Zeichen_Ticker.pde @@ -0,0 +1,13 @@ +void setup() +{ + size(800, 600); +} + +void draw() +{ + // Clear Background to prevent shadows + background(40, 40, 40, 256); + + textSize(50); + text(key, width / 2, height / 2); +} diff --git a/Lektion 1/Text-Ausgabe/Ecken/Ecken.pde b/Lektion 1/Text-Ausgabe/Ecken/Ecken.pde new file mode 100644 index 0000000..97679a9 --- /dev/null +++ b/Lektion 1/Text-Ausgabe/Ecken/Ecken.pde @@ -0,0 +1,19 @@ +void setup() { + size(500, 500); +} + +void draw() { + textSize(20); + textAlign(LEFT, TOP); + fill(0); + text("OBEN LINKS", 0, 0); + textAlign(RIGHT, TOP); + fill(0); + text("OBEN RECHTS", width, 0); + textAlign(LEFT, BOTTOM); + fill(0); + text("UNTEN LINKS", 0, width); + textAlign(RIGHT, BOTTOM); + fill(0); + text("UNTEN RECHTS", width, width); +} diff --git a/Lektion 1/Text-Ausgabe/TextMauszeiger/TextMauszeiger.pde b/Lektion 1/Text-Ausgabe/TextMauszeiger/TextMauszeiger.pde new file mode 100644 index 0000000..be51116 --- /dev/null +++ b/Lektion 1/Text-Ausgabe/TextMauszeiger/TextMauszeiger.pde @@ -0,0 +1,11 @@ +void setup() { + size(600, 600); +} + +void draw() { + background(200); + textSize(20); + textAlign(CENTER); + fill(0); + text("maus", mouseX, mouseY); +} diff --git a/Lektion 1/Text-Ausgabe/Text_mit_Schatten/Text_mit_Schatten.pde b/Lektion 1/Text-Ausgabe/Text_mit_Schatten/Text_mit_Schatten.pde new file mode 100644 index 0000000..ff58e5f --- /dev/null +++ b/Lektion 1/Text-Ausgabe/Text_mit_Schatten/Text_mit_Schatten.pde @@ -0,0 +1,8 @@ +size(300, 300); + +textSize(100); +textAlign(CENTER); +fill(0, 100); +text("Julia", 153, 153); +fill(255); +text("Julia", 150, 150); diff --git a/Lektion 1/Zeichnen/Schwarz_wei__rechteck/Schwarz_wei__rechteck.pde b/Lektion 1/Zeichnen/Schwarz_weiss_rechteck/Schwarz_weiss_rechteck.pde similarity index 100% rename from Lektion 1/Zeichnen/Schwarz_wei__rechteck/Schwarz_wei__rechteck.pde rename to Lektion 1/Zeichnen/Schwarz_weiss_rechteck/Schwarz_weiss_rechteck.pde diff --git a/Lektion 1/Zeichnen/Stern/Stern.pde b/Lektion 1/Zeichnen/Stern/Stern.pde index 7a31344..13f275f 100644 --- a/Lektion 1/Zeichnen/Stern/Stern.pde +++ b/Lektion 1/Zeichnen/Stern/Stern.pde @@ -1,16 +1,24 @@ -background (233,0,57); // roter Hintergrund -noStroke (); // Entfernung der Linien um Überlappung beider Figuren zu verbergen -fill (1,50,100); //blaue Färbung + + +fill (255, 10); // sorgt für Sichtbarkeit aller Linien (Transparenz) + beginShape (); // Vieleck mit Spitze nach oben vertex (30,80); //linker "Fuß" vertex (50,15); //die obere Spitze vertex (70,80); //rechter "Fuß" -vertex (45,60); // Verbindungspunkt -endShape (); +vertex (50,65); // Verbindungspunkt +endShape (CLOSE); beginShape (); //Vieleck mit Spitze nach schräg rechts vertex (80, 40); // rechter Arm Spitze vertex (30, 80); // linker Fuß -vertex (35, 55); // Verbindungspunkt +vertex (37, 55); // Verbindungspunkt vertex (20, 40); // linker Arm Spitze -endShape (); +endShape (CLOSE); + +beginShape (); // Vieleck mit Spitze nach schräg links +vertex (70,80); //rechter Fuß +vertex (20,40); //linker Arm +vertex (80,40); //rechter Arm +vertex (63,55); // Verbindungspunkt +endShape (CLOSE); diff --git a/Lektion 1/Zeichnen/Stern_abgebe_version/Stern_abgebe_version.pde b/Lektion 1/Zeichnen/Stern_abgebe_version/Stern_abgebe_version.pde deleted file mode 100644 index 13f275f..0000000 --- a/Lektion 1/Zeichnen/Stern_abgebe_version/Stern_abgebe_version.pde +++ /dev/null @@ -1,24 +0,0 @@ - - -fill (255, 10); // sorgt für Sichtbarkeit aller Linien (Transparenz) - -beginShape (); // Vieleck mit Spitze nach oben -vertex (30,80); //linker "Fuß" -vertex (50,15); //die obere Spitze -vertex (70,80); //rechter "Fuß" -vertex (50,65); // Verbindungspunkt -endShape (CLOSE); - -beginShape (); //Vieleck mit Spitze nach schräg rechts -vertex (80, 40); // rechter Arm Spitze -vertex (30, 80); // linker Fuß -vertex (37, 55); // Verbindungspunkt -vertex (20, 40); // linker Arm Spitze -endShape (CLOSE); - -beginShape (); // Vieleck mit Spitze nach schräg links -vertex (70,80); //rechter Fuß -vertex (20,40); //linker Arm -vertex (80,40); //rechter Arm -vertex (63,55); // Verbindungspunkt -endShape (CLOSE); diff --git a/scratch/ArithmetischeOperatoren.pde b/scratch/ArithmetischeOperatoren.pde new file mode 100644 index 0000000..f9ae7e3 --- /dev/null +++ b/scratch/ArithmetischeOperatoren.pde @@ -0,0 +1,72 @@ +void setup() { + size(800, 600); +} + +// Animation mit Modulo +/*void draw() { + background(200); + ellipse(frameCount%width, 300, 100, 100); +}*/ + +// Muster 4 +/*int x = 0; +int y = 0; + +void draw() { + stroke(x / (width / 255)); + line(x, 0, x, y); + x+= 1; + y+= 1; +}*/ + +// Muster 3 +/*int x = 0; +int y = 0; + +void setup() { + size(800, 600); + + y = height; +} + +void draw() { + line(x, 0, x, y); + x+= 1; + y-= 1; +}*/ + +// Muster 2 +/*int x = 0; +int y = 0; + +void draw() { + if (x % 3 == 0) { + stroke(0); + } else if (x % 3 == 1) { + stroke(150); + } else { + stroke(230); + } + + line(x, 0, x, y); + x+= 1; + y+= 1; +}*/ + +// Muster 1 +/*int x = 0; +float y = 0; + +void draw() { + if (x % 3 == 0) { + stroke(0); + } else if (x % 3 == 1) { + stroke(150); + } else { + stroke(230); + } + + line(x, 0, x, y); + x+= 1; + y+= 0.5; +}*/ \ No newline at end of file diff --git a/scratch/Datentypen.pde b/scratch/Datentypen.pde new file mode 100644 index 0000000..082c2a3 --- /dev/null +++ b/scratch/Datentypen.pde @@ -0,0 +1,32 @@ +/*void setup() { + size(800, 600); +}*/ + +// Zeichenverkettung +String message = "la"; + +void setup() { + size(800, 600); +} + +void draw() { + frameRate(10); + println(message); + message += " la"; +} + +// Halbe Pixel? +// Der Kreis wandert alleine nach rechts +/*float x = 0; + +void draw() { + background(255); + x+=0.5; + ellipse(x, 50, 30, 30); +}*/ + +// Mausposition ausgeben +/*void draw() { + frameRate(10); + println("x=" + mouseX + " y=" + mouseX); +}*/ \ No newline at end of file diff --git a/scratch/Stern/Stern.pde b/scratch/Stern/Stern.pde new file mode 100644 index 0000000..7a31344 --- /dev/null +++ b/scratch/Stern/Stern.pde @@ -0,0 +1,16 @@ +background (233,0,57); // roter Hintergrund +noStroke (); // Entfernung der Linien um Überlappung beider Figuren zu verbergen +fill (1,50,100); //blaue Färbung +beginShape (); // Vieleck mit Spitze nach oben +vertex (30,80); //linker "Fuß" +vertex (50,15); //die obere Spitze +vertex (70,80); //rechter "Fuß" +vertex (45,60); // Verbindungspunkt +endShape (); + +beginShape (); //Vieleck mit Spitze nach schräg rechts +vertex (80, 40); // rechter Arm Spitze +vertex (30, 80); // linker Fuß +vertex (35, 55); // Verbindungspunkt +vertex (20, 40); // linker Arm Spitze +endShape (); diff --git a/scratch/lokale und systemvariablen/Lektion_1_LokaleUndSystemvariablen.pde b/scratch/lokale und systemvariablen/Lektion_1_LokaleUndSystemvariablen.pde new file mode 100644 index 0000000..e8bfcd7 --- /dev/null +++ b/scratch/lokale und systemvariablen/Lektion_1_LokaleUndSystemvariablen.pde @@ -0,0 +1,135 @@ +/* + + ----Lokale Variablen---- + +1. Wie lange ist eine Variable gültig, die innerhalb einer Funktion deklariert wurde? + + - bis zum Ende des Programms + - bis zum Ende des nächsten Durchlaufs der draw-Funktion + X bis zum Ende der Funktion + +2. Wie wird der Bereich bezeichnet, in dem eine Variable gültig ist und verwendet werden kann? + +Scope + +3. Was genau passiert, wenn sich zwei Variablen überschatten? Worauf muss man achten, wenn man Überschattung vermeiden möchte? + +Bei "variable shadowing" wird der Wert einer globalen Variable im Scope der Funktion der lokalen Variable "überschattet". +Wenn man vorher also eine globale Variable (x = 5) setzt, diese in der Funktion setX() als lokale Variable neu Deklariert und Initialisiert (x = 3) , +Überschattet der Wert der Lokalen Variable (x = 3) für dessen Scope die globale Variable. Geht die lokale Variable "out of scope", dann +gilt wieder der Wert der globalen Variable. + +Um dies zu verhindern sollte man nie den selben Namen für eine Variable verwenden und bei Zuweisungen darauf achten keinen Datentyp dem +Namen voranzusetzen. + +*/ + + + +// Aufgabe 1 +void zwillinge() +{ + // Clear Background to prevent shadows + background(40, 40, 40, 256); + + //First circle + fill(0, 50, 256); + circle(mouseX, mouseY, 100); + + // Second circle + // project mouse pos between 0 and 1. Take inverse to get the point symmetric postion + PVector fitMouse = new PVector((float) mouseX / (float) width, (float) mouseY / (float) height); + PVector twinPos = new PVector((1.0f - fitMouse.x) * width, (1.0f - fitMouse.y) * height); + + fill(256, 50, 0); + circle(twinPos.x, twinPos.y, 100); + + + //println(fitMouseX + ", " + inverseMouseX ); +} + +void drillinge() +{ + // Clear Background to prevent shadows + background(40, 40, 40, 256); + + + line(0, 0, mouseX, mouseY); + + circle(mouseX, mouseY, 10); + circle(mouseX * .5, mouseY * .5, 10); +} + +/* + ----Systemvariablen---- + +1. Was sind Systemvariablen? + +Systemvariablen sind variablen die bereitgestellt werden um diese zu verwenden. Beispielsweise die Mausposition oder die Fenstergröße + +2. Was passiert, wenn du eine Variable anlegst, die den selben Namen wie eine Systemvariable hat? Tip: Probiere es mal aus ... + +Die Systemvariable wird von dem selbst gesetzten Wert überschrieben. + +3. Welche 2 Dinge sollte man im Bezug auf Systemvariablen niemals machen? Warum? + + - Den Systemvariablen einen neuen Wert zuweisen + - Eigenen Variablen den selben Namen geben +*/ + +void zeichenTicker() +{ + // Clear Background to prevent shadows + background(40, 40, 40, 256); + + textSize(50); + text(key, width / 2, height / 2); +} + +void mitte() +{ + // Beim übertragen richtige Fenstergröße (111 x 77) in die main (setup) Methode eintragen und surface.setResizable(true) setzen + background(40, 40, 40, 256); + circle(width/2, height/2,50); + +} + +float second; +float offset = 0; + +void zähler() +{ + background(40, 40, 40, 256); + //fill(0,0,0,1); + second = constrain(((float) frameCount / (float) frameRate) - offset, 0 , 1000); + + if(mousePressed == true) + { + offset = second + offset ; + } + + println(offset + " " + mousePressed); + textSize(50); + text(second, width / 2 -50, height/2); +} + +void setup() +{ + size(800, 600); + frameRate(144); + //surface.setResizable(true); +} +void draw() +{ + + // ----lokale Variablen---- + // zwillinge(); + drillinge(); + + // ----Systemvariablen---- + //zeichenTicker(); + //mitte(); + // zähler(); + +} + diff --git a/lokalesystemvariablen/lokalesystemvariablen.pde b/scratch/lokalesystemvariablen/lokalesystemvariablen.pde similarity index 100% rename from lokalesystemvariablen/lokalesystemvariablen.pde rename to scratch/lokalesystemvariablen/lokalesystemvariablen.pde