Difference between revisions of "P5js-Dom-Textarea"

From Digipool-Wiki
Jump to: navigation, search
(Example)
Line 22: Line 22:
 
   myInput.position(100, 100);
 
   myInput.position(100, 100);
 
   myInput.size(200,200);
 
   myInput.size(200,200);
   createCanvas(400, 400);
+
   myInput.style("resize", "none");
 
}
 
}
  

Revision as of 14:58, 21 June 2021

Befehl


myInput = createElement('textarea', 'your text here');

myString = myInput.value();


Example

var myString;
var myInput;

function setup() {
  myInput = createElement('textarea', 'your text here');
  myInput.position(100, 100);
  myInput.size(200,200);
  myInput.style("resize", "none");
}

function draw() {
  background(220);
  
  myString = myInput.value();
  text(myString, 20, 20);
}