Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

p5.js how to display a text from string

//
text("your string")
//
function setup() { 
   
    // Creating Canvas size
    createCanvas(600, 160); 
} 
   
function draw() { 
       
    // Set the background color 
    background(220); 
     
    // Initializing some values
    let Value1 = 12;
    let Value2 = 12.5;
    let Value3 = -7.9;
    let Value4 = -6;
    let Value5 = "6";
     
    // Calling to str() function.
    let A = str(Value1);
    let B = str(Value2);
    let C = str(Value3);
    let D = str(Value4);
    let E = str(Value5);
       
    // Set the size of text 
    textSize(16); 
       
    // Set the text color 
    fill(color('red')); 
     
    // Getting string representation
    text("String representation of value 12 is: " + A, 50, 30);
    text("String representation of value 12.5 is: " + B, 50, 60);
    text("String representation of value -7.9 is: " + C, 50, 90);
    text("String representation of value -6 is: " + D, 50, 110);
    text("String representation of string '6' is: " + E, 50, 140);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: chrome block javascript alert 
Javascript :: jquery validation from data 
Javascript :: javascript prototype inheritance example 
Javascript :: end session express 
Javascript :: overflowy 
Javascript :: math captcha 
Javascript :: getmonth js 
Javascript :: what is asynchronous 
Javascript :: how can hide link from inspect element 
Javascript :: swr npm 
Javascript :: filter in javascript 
Javascript :: how to set selected value of dropdown in javascript 
Javascript :: jquery add 
Javascript :: js array.some 
Javascript :: array of obj to obj with reduce 
Javascript :: export excel form angular array to excel 
Javascript :: what is asynchronous in javascript 
Javascript :: what is $ in jquery 
Javascript :: change module name react native android studio 
Javascript :: javascript goto page 
Javascript :: for of in js or for in loop in js 
Javascript :: query string to object javascript 
Javascript :: javascript input value change 
Javascript :: how to handle errors with xmlhttprequest 
Javascript :: node js require file in parent directory 
Javascript :: reactjs change fill color .svg 
Javascript :: reactjs get one document from firestore 
Javascript :: react merge two objects 
Javascript :: node fetch response body 
Javascript :: sortable jquery 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =