-
Text Scrolling by line and random intervals
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 durationc = 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 sizepini = [thisComp.width/2,thisComp.height+(ty/2)];
pfin = [thisComp.width/2,-ty/2];
// initial and finish position of paragraph textn_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 proportionalintervalo = 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 stopminVal = 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]