We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › pulling nexttext in multiple directions
Page Index Toggle Pages: 1
pulling nexttext in multiple directions (Read 1023 times)
pulling nexttext in multiple directions
Aug 23rd, 2009, 2:06pm
 
hello

i am using the nexttext library and am hoping to find an example that shows how to pull text in multiple directions at once.

the puller example shows how the text pulls towards the mouse location.
i would like the text to expand to multiple directions. like foam expanding until is fills a shape completely.

thanks for any advice.

stephan.
Re: pulling nexttext in multiple directions
Reply #1 - Aug 27th, 2009, 5:24am
 
as an update to my own post:

i received an email from Elie with the following suggestion


*****
Code:
import net.nexttext.*;
import net.nexttext.behaviour.*;
import net.nexttext.behaviour.control.*;
import net.nexttext.behaviour.standard.*;
import net.nexttext.behaviour.dform.*;
import net.nexttext.renderer.*;

// attributes
Book book;
PFont gangOfThree;

void setup() {
// init the applet
size(640, 360);
smooth();

// create the book
book = new Book(this);

// pull the text with the first mouse button
AbstractAction pullLeft = new Pull(new Vector3(0, height/2), 10, 2);
AbstractAction pullRight = new Pull(new Vector3(width, height/2), 10, 2);
AbstractAction pullUp = new Pull(new Vector3(width/2, 0), 10, 2);
AbstractAction pullDown = new Pull(new Vector3(width/2, height), 10, 2);

// add the behaviours to the book
book.addGroupBehaviour(pullLeft.makeBehaviour());
book.addGroupBehaviour(pullRight.makeBehaviour());
book.addGroupBehaviour(pullUp.makeBehaviour());
book.addGroupBehaviour(pullDown.makeBehaviour());

// init and set the font
gangOfThree = createFont("GangOfThree.ttf", 28, true);
textFont(gangOfThree);
textAlign(CENTER);

// set the text colour
fill(#656F28);
stroke(0);
strokeWeight(2);
//noStroke();

// add the text
book.addText("Dogs are forever in the push up position.", width/2, height/2);

// set the background colour
noStroke();
fill(212, 222, 152, 50);
}

void draw() {
// draw a semi-transparent background to give all elements ghost trails
rect(0, 0, width, height);

// apply the behaviours to the text and draw it
book.stepAndDraw();
}


*****
Page Index Toggle Pages: 1