Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Example: My favorite cities

String[] cities = new String[5];
PFont font;


void setup() {
  size(1920, 1080); 
  cities[0] = "Paderborn";
  cities[1] = "Münster";
  cities[2] = "Amsterdam";
  cities[3] = "Lisbon";
  cities[4] = "Paris";
  font = createFont("sans.otf",1000);
}

void draw() {
  background(0);
  
  int index = int(map(mouseX,0,width,0,cities.length));
  
  float w = width/cities.length;
  
  noStroke();
  fill(#444444);
  rect(w*index,0,w,height);
  
  
  fill(#f1f1f1);
  push();
  translate(width/2,height/2);
  textFont(font);
  textSize(300);
  textAlign(CENTER,CENTER);
  text(cities[index],0,0);
  pop();
  fill(#ff0000);
  ellipse(mouseX,mouseY,40,40);
  rec();
}
copy
Comment

PREVIOUS NEXT
Code Example
Java :: masquer saisie mot de passe java console 
Java :: ex: Overflow in java 
Java :: java windowbuilder launch on second monitor 
Java :: java casting method 
Java :: what is instance block in java 
Java :: Java Using range(e1, e2) Method 
Java :: method overloading in java 
Java :: jdbc code 
Java :: selenium treeview java 
Java :: how can i press a key using action class i java ? 
Java :: spring environment null pointer exception 
Java :: java array kürzen 
Java :: how to send rest request graphql java 
Java :: java loop aray 
Java :: index out of bounds exception java 
Java :: spring boot dto example 
Java :: check whether an entry in hashmap is deleted in java 
Java :: android studio cannot resolve @nullable 
Java :: what happens if you return only -1 and 1bute not 0 java 
Java :: illegal expression 
Java :: add days to a date java 
Java :: how to uncomment a block of statements in java 
Java :: final variables in java 
Java :: class in java 
Java :: Jlabel icon 
Java :: sorting algorithms in java 
Java :: Calling A Class From Another Class In Java 
Java :: java format double no decimal places 
Java :: polimorfismo java ejemplo 
Java :: graph with dependies problem 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =