Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Text Scrolling by line and random intervals

  • Text Scrolling by line and random intervals

    Posted by Ecko Locko on March 13, 2016 at 3:34 pm

    Hi,

    hope you can help me or get a solution to my expression.

    I’m trying to make an expression that allows me to create a vertical scroll of a text paragraph in which the number of pixels of the scroll is determined based on the size of each line and the length of the scroll is limited by the duration of the layer.

    My main interest was that the scroll make progress in random increments of the size of each line , so that advance different number of lines at a time but I’m starting to take it for impossible.

    At the moment it works but not as I would like, would be very grateful if any of you could take a look and see how it could optimize it or get my goal.

    Actually the final intention of the project was to simulate a live chat window, I have very long texts of chats that I want to compose with this effect.

    Thank you very much in advance for your attention and help, you are a great community and have helped me always.

    Greetings.

    I paste my code with annotations if help a faster understanding..

    Code for Position

    t_total = outPoint-inPoint;
    // layer duration

    c = thisLayer;
    rect = c.sourceRectAtTime(time,false);
    w = rect.width; h = rect.height;
    sx = c.scale[0]; sy = c.scale[1];

    tx = (w*sx)/100; ty = ( (h*sy)/100 );
    // paragraph text size

    pini = [thisComp.width/2,thisComp.height+(ty/2)];
    pfin = [thisComp.width/2,-ty/2];
    // initial and finish position of paragraph text

    n_lineas = c.text.sourceText.split(/\n|\r/).length;
    // number of lines of paragraph text

    /*
    f = 0;
    f=framesToTime(f, fps = 1.0 / thisComp.frameDuration);

    Number of frames if i want to create a jump cut or soft interpolation between stops, dont know how i can add this
    */

    time_linea = t_total/n_lineas;
    // line text time proportional
    tam_linea = ty/n_lineas;
    // line size proportional

    intervalo = timeToFrames(time_linea);
    // interval of time between stops or hold positions of scroll

    // I try this but with no good results
    // This is a try to get diferent intervals of lines for each stop

    minVal = 3;
    maxVal = 10;
    seed = Math.floor(timeToFrames(time)/intervalo);
    seedRandom(seed,true);
    cant = Math.floor(random(minVal,maxVal));
    dist =Math.abs(tam_linea*cant);

    dist = tam_linea;
    // I didnt use random dist and put line size

    // function that returns the number of cycles or lines made
    function np()
    {

    tf = timeToFrames(time);
    i=0; n=0;

    while(i=1)
    {

    f = framesToTime(intervalo);
    py_ant = valueAtTime(f*(np()))[1];
    // before cycle position
    pini-[0,(dist*np())-py_ant]

    }
    else
    {
    pini - [0,dist*np()]
    }

    And this code for Anchor Point


    R = thisLayer.sourceRectAtTime(time);
    T = R.top; L = R.left;
    W = R.width; H = R.height;
    [L+W/2,T+H/2]

    Ecko Locko replied 10 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Vinny Visconti

    March 18, 2016 at 9:47 pm

    did you ever find a solution for this? i want to do something similar and have not figured out how to do it. i end up keyframing everything, but expression would make my life easier.

  • Ecko Locko

    March 22, 2016 at 4:37 pm

    Hi vinny,

    the expression works half, makes a line by line vertical scroll but not in the way i wanted (in layer duration and at random intervals). Dont know if someone can help at this moment but think that there must be a more effective solution. In my expression I rely on the size of the paragraph and the number of lines for the scroll but I think we should try to make the expressions in a expression selector in the text options, one for the appearance of characters and another for lines. I hope to have time to continue mulling over and if I find a solution I update the post.

    I hope that some wizard expressions could help but perhaps the post does not help someone to join.

    Anyway, we keep trying.

    Regards

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy