# If I want to show only 1 time my text what can I use?

**URL:** <https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208>\
**Category:** Coding Questions\
**Created:** [April 12, 2019, 8:35am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208 "2019-04-12T08:35:03Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![fwtini](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fwtini](https://discourse.processing.org/u/fwtini)\
**Post date:** [April 12, 2019, 8:35am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/1 "2019-04-12T08:35:03Z")

</div>

```auto
 PFont myFont;
 float rotateVal=0.4;
 String s1= ("test");
 
 
 
 float x,y,z;
void setup(){
  background(255);
  size(500,500,P3D);
 myFont = loadFont("Serif-48.vlw");

//frameRate(20);

}

void draw(){
  
  

  
  
  pushMatrix();
 // pointLight(255,0,0,width/2,height/2,200);
  translate(100,100);
 rotateY(rotateVal);
 rotateX(x +=0.05);
textSize(100);
fill(0);

 
text(s1,x/4,rotateVal);
 
popMatrix();

}

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 12, 2019, 8:44am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/2 "2019-04-12T08:44:02Z")

</div>

At the end of draw you can set a boolean firstTime to false

before your text check if(firstTime) {…

}

before setup ()

boolean firstTime = true;

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 12, 2019, 8:45am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/3 "2019-04-12T08:45:32Z")

</div>

Alternatively use a timer that sets firstTime to false

if(millis()-timer) \> 880) firstTime = false;

That would display the text a bit longer

---

<div class="post-metadata">

**Author:** ![fwtini](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fwtini](https://discourse.processing.org/u/fwtini)\
**Post date:** [April 12, 2019, 8:58am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/4 "2019-04-12T08:58:26Z")

</div>

before my text you mean for void draw() ?  
v=can you please explain it ? =p

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 12, 2019, 8:59am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/5 "2019-04-12T08:59:43Z")

</div>

Inside draw the if clause is around the text section to not show it when firstTime is false

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 12, 2019, 8:59am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/6 "2019-04-12T08:59:53Z")

</div>

See if in the reference

---

<div class="post-metadata">

**Author:** ![fwtini](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fwtini](https://discourse.processing.org/u/fwtini)\
**Post date:** [April 12, 2019, 9:21am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/7 "2019-04-12T09:21:14Z")

</div>

> [@Chrisir](#):
>
> boolean firstTime = true;

```auto
 PFont myFont;
 float rotateVal=0.4;
 String s1= ("test");
 color a= color(0,10);

 
float firstTime;
int timer;
 float x,y,z;

   
void setup(){
  background(255);
  size(500,500,P3D);

 myFont = loadFont("Serif-48.vlw");

firstTime =millis();

}

void draw(){
  

  if(millis()-timer) > 880) firstTime = false;
  
  pushMatrix();

 // pointLight(255,0,0,width/2,height/2,200);
  translate(100,100);
 rotateX(rotateVal);
 rotateX(x +=0.05);
textSize(100);
fill(a);
alpha(a);
 
text(s1,x,rotateVal,width,height/2);

popMatrix(); 
}

```

---

<div class="post-metadata">

**Author:** ![fwtini](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fwtini](https://discourse.processing.org/u/fwtini)\
**Post date:** [April 12, 2019, 9:23am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/8 "2019-04-12T09:23:28Z")

</div>

what am I doing wrong!!! I tried and something miss it. I guess!  
Sorry I am trying to figure it out but I think I am lost in translation =p

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 12, 2019, 9:58am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/9 "2019-04-12T09:58:01Z")

</div>

you need background at start of draw()

several changes below

```auto
PFont myFont;
float rotateVal=0.4;
String s1= "test";
color a= color(0);

boolean firstTime = true; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

int timer; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

float x, y, z;

void setup() {
  size(500, 500, P3D);
  background(255);

  myFont = createFont("Serif-48.vlw", 14);
  textSize(100);
  fill(a);

  timer = millis(); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}

void draw() {

  background(255);

  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  if (firstTime) { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    text(s1, 200, 200 );
  } // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  if (millis()-timer > 880) {
    firstTime = false;
  }
}

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 12, 2019, 10:06am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/10 "2019-04-12T10:06:20Z")

</div>

For an animation you need to have background () at start of draw ()

Maybe I misunderstood you. I thought you meant to show a text at startup that them disappears for good

Maybe you were referring to animation. Then your code is valid just use background

---

<div class="post-metadata">

**Author:** ![fwtini](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fwtini](https://discourse.processing.org/u/fwtini)\
**Post date:** [April 12, 2019, 10:17am UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/11 "2019-04-12T10:17:53Z")

</div>

yes it’s the background hahah thank you very much!  
And If i want to rotate from different directions I use the rotateX, rotateY yes?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 12, 2019, 12:42pm UTC](https://discourse.processing.org/t/if-i-want-to-show-only-1-time-my-text-what-can-i-use/10208/12 "2019-04-12T12:42:08Z")

</div>

that’s right

Apologies that I misunderstood you first!

```auto
PFont myFont;
float rotateVal=0.4;
String s1= "test";

color a= color(0); // black 
color b= color(255, 2, 2); //red 
color c= color(2, 2, 255); //blue

float x, y, z;

void setup() {
  size(1500, 500, P3D);
  background(255);

  myFont = createFont("Serif-48.vlw", 19);
  textFont( myFont );
  textMode(SHAPE);
}

void draw() {
  background(255);

  // floor 
  float yValueFloor = height;
  // show floor 
  checkeredFloor(yValueFloor);

  pushMatrix();
  // pointLight(255,0,0,width/2,height/2,200);
  translate(100, 100);
  rotateX(rotateVal);
  rotateX(x +=0.05);
  textSize(100);
  fill(a);
  alpha(a);
  text(s1, x, rotateVal, width, height/2);
  popMatrix();

  pushMatrix();
  // pointLight(255,0,0,width/2,height/2,200);
  translate(700, 300);
  rotateY(rotateVal + (x +=0.05));
  textSize(100);
  fill(b);
  //alpha(a);
  textAlign(CENTER);
  text(s1, 0, 0);
  textAlign(LEFT);
  popMatrix();

  pushMatrix();
  translate(1200, 300, z);
  rotateZ(rotateVal + (x +=0.05));
  textSize(100);
  fill(c);
  textAlign(CENTER);
  text(s1, 0, 0);
  textAlign(LEFT);
  z--;
  popMatrix();
}

void checkeredFloor(float yValueFloor) {

  noStroke();

  for (int i = 0; i < 50; i = i+1) {
    for (int j = -40; j < 42; j = j+1) {

      // % is modulo, meaning rest of division 
      if (i%2 == 0) { 
        if (j%2 == 0) { 
          fill (255, 0, 0);
        } else 
        {
          fill ( 103 );
        }
      } else {
        if (j%2 == 0) { 
          fill ( 103 );
        } else 
        {
          fill (255, 0, 0);
        }
      } // if

      pushMatrix();
      translate ( 80*i-610, yValueFloor, 80*j-940 );
      box ( 80, 7, 80); // one cell / tile 
      popMatrix();
    } // for
  } // for
} // function

```
