# 【text\_to\_path】two lines cannot reveal along the path

**URL:** <https://discourse.processing.org/t/text-to-path-two-lines-cannot-reveal-along-the-path/7154>\
**Category:** Libraries\
**Created:** [January 4, 2019, 10:26am UTC](https://discourse.processing.org/t/text-to-path-two-lines-cannot-reveal-along-the-path/7154 "2019-01-04T10:26:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shang](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@shang](https://discourse.processing.org/u/shang)\
**Post date:** [January 4, 2019, 10:26am UTC](https://discourse.processing.org/t/text-to-path-two-lines-cannot-reveal-along-the-path/7154/1 "2019-01-04T10:26:46Z")

</div>

hi guys, i stuck in the situation that the tow text-line cannot reveal along the path. Following is the code …

```auto
import tracer.*;
import tracer.paths.*;

//style
int fgColor = #FFFFFF; //foreground color
int bgColor = #DC443A; //background color

//text
String text = "Experiment A...Experiment B...Experiment C ";
float startu; //1D position where text starts
float dstartu = 0.00005; //1D text speed per millisecondimport tracer.*;
import tracer.paths.*;

//path
//Lissajous path;

CubicBezier bezier1;
CubicBezier bezier2;
CubicBezier bezier3;
CubicBezier bezier4;
Composite path1;
Composite path2;
Composite path3;

float dphi = 0.0005; //change in phi per millisecond

int d;
int k;

//time
int prevt; //the previous time in milliseconds

void setup(){
 size(360, 360, P2D);
 
 bezier1 = new CubicBezier (100, 0, 360, 0, 100, 200, 460, 200);
 bezier2 = new CubicBezier (0, 100, 360, 100, 0, 300, 360, 300);
 bezier3 = new CubicBezier (-100, 200, 260, 200, -100, 200, 260, 200);
 bezier4 = new CubicBezier (-200, 300, 160, 300, -200, 300, 160, 300);
 path1 = new Composite (bezier1, bezier2);
 path2 = new Composite (bezier3, bezier4);
 path3 = new Composite (path1, path2);
 
 prevt = millis();
}

void draw() {
 int dt = millis() - prevt;
 prevt = millis();
 startu += dstartu * dt; 

 background(bgColor);
 noStroke();
 fill(fgColor);
 textSize(22);

 for (int k=0; k<1; k++){  
   String stringk = text;
   embedText(path3, stringk);
 }
}

 void embedText (Path path3, String stringk) {
 Point a = new Point(0, 0);
 Point b = new Point(0, 0);

 float textWidthAcc = 0; 
 float textWidthTotal = textWidth(text); 
 
 for (int i=0; i<stringk.length(); i++) {
 char c = stringk.charAt(i);
       textWidthAcc += 0.5 * textWidth(c);
       float u = (startu + map(textWidthAcc, 0, textWidthTotal, 0, 1 )) % 1;
       path3.trace(a, u);
       path3.trace(b, (u + 0.000001) % 1.0);

   float angleOfRotation = atan2(b.y - a.y, b.x - a.x);
   drawChar(stringk.charAt(i), a.x, b.y, angleOfRotation);
   textWidthAcc += 0.5 * textWidth(c);

   println(a);
 }    
}

void drawChar(char c, float x, float y, float angle) {
 textAlign(CENTER, CENTER);
 pushMatrix();
 translate(x, y);
 rotate(angle);
 text(c, 0, 0);
 popMatrix();
}

```

it ends up becoming …

 ![27](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/42767fb71a2b6b31ca2514e7e86324afa7eadea6.png)

I am so curious why the two lines below cannot reveal along the path … looking forward to your reply!

Shang

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [January 24, 2019, 12:07am UTC](https://discourse.processing.org/t/text-to-path-two-lines-cannot-reveal-along-the-path/7154/2 "2019-01-24T00:07:58Z")

</div>

@shang – sorry about missing this question. were you able to resolve your problem?

---

<div class="post-metadata">

**Author:** ![shang](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@shang](https://discourse.processing.org/u/shang)\
**Post date:** [January 24, 2019, 9:02am UTC](https://discourse.processing.org/t/text-to-path-two-lines-cannot-reveal-along-the-path/7154/3 "2019-01-24T09:02:30Z")

</div>

The problem has been solved, thank you 🙂
