dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: rotate text in spiral

  1. #1
    Member
    Join Date
    Jul 2000
    Location
    Venezuela
    Posts
    86

    rotate text in spiral

    Hi,

    I already have my function to make the spiral, but I dont know what factor or equation need to calculate the rotation of each char. This is what I have for now and look where I put the comment.

    Thanks!

    Rafael G


    PHP Code:
    string "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah ";
    textList = [];
    for (
    x=0x<string.lengthx++) {
        
    textList.push(string.substr(x1));
    }
    trace(textList);

    var 
    my_fmt:TextFormat = new TextFormat(); 
    my_fmt.font "Font 1";
    my_fmt.bold true;
    my_fmt.size 12;

    _root.createEmptyMovieClip("holderMC"1);
    theta 10;
    10;
    step 1
    prevPtX 
    Stage.width/2;
    prevPtY Stage.height/2;
    drawI setInterval(drawF1);

    function 
    drawF() {
        
    theta theta+.1;
        
    += 0.01;
        
    rad theta*a;
        
    nextPtX rad*Math.cos(theta)+Stage.width/2;
        
    nextPtY rad*Math.sin(theta)+Stage.height/2;

        
    step++;
        
    _root.createTextField("t"+stepstepnextPtXnextPtY1010);
        
    _root["t"+step].wordWrap true;
        
    _root["t"+step].embedFonts true;
        
    _root["t"+step].textColor 0xFFFFFF;
        
    _root["t"+step].text textList[step];
        
    _root["t"+step].setTextFormat(my_fmt);
        
    _root["t"+step]._x newX;
        
    _root["t"+step]._y newY;
        
    _root["t"+step]._rotation = ????????????; // here need the rotation function
        
        
    if (textList[step] == undefined) {
            
    clearInterval(drawI);
        }

        
        
    prevPtX nextPtX;
        
    prevPtY nextPtY;

    www.rafaelguedez.com

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    theta is the angle of your current spot in the spiral - you just need to convert it from radians to degrees.

    _root["t"+step]._rotation = theta * 180/Math.PI;

    - Jim

  3. #3
    Member
    Join Date
    Jul 2000
    Location
    Venezuela
    Posts
    86
    Really thanks! work perfect

    Rafael
    www.rafaelguedez.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center