Activity › Forums › Adobe After Effects Expressions › Random time remap
-
Rafael Braz
November 6, 2014 at 8:56 pmWhen I paste this code on time remap, it works just as I want it.
But what I’d like to do is to control when this expression starts and ends, otherwise I’ll have to split all layers in order to control it.
I’m sorry if I wasn’t clear.
Thanks a lot for your support, though.tStart = 1;
tStop = 3;
if (time > tStart && time < tStop){
t = time - tStart;
frameDur = 15;
f = timeToFrames(t);
seg = Math.floor(f/frameDur);
seedRandom(seg+1113,true);
rf = Math.floor(random(3));
framesToTime(rf)
}else 0 -
Dan Ebberts
November 6, 2014 at 9:03 pmBut if you replace the “1” in the first line with a link to a slider set to 1 and replace the “3” in the second line with a link to another slider set to 3, it no longer works?
Dan
-
Rafael Braz
November 6, 2014 at 9:09 pmWhen I’m using this expression linked to sliders, nothing happens, even when I set them to 1 and 3, like you said… 🙁
tStart = effect("Slider Control")("Slider");
tStop = effect("Slider Control 2")("Slider");
if (time > tStart && time < tStop){
t = time - tStart;
frameDur = 15;
f = timeToFrames(t);
seg = Math.floor(f/frameDur);
seedRandom(seg+1113,true);
rf = Math.floor(random(3));
framesToTime(rf)
}else 0 -
Dan Ebberts
November 6, 2014 at 9:24 pmI just tried it and it works the same for me with the sliders or the hard-coded values. I’m not sure what’s going on.
I suspect though, that you may be after something more complicated (you haven’t said so though, so I could be wrong). Did you need to be able to have it start,stop,start,stop, etc. ? That would be a completely different thing.
Dan
-
Rafael Braz
November 6, 2014 at 9:34 pmYea, the ideia is to be able to control the time remaping expression starts and stops.
I tried to isolate the layer in a new comp to make tests and now when I use this expression, I get an error message:
Error at line 3 in property ‘Time remap’ of layer 1 (‘C 2’) in comp ‘teste’.
Expected: ).tStart = 1;
tStop = 3;
if (time > tStart && time < tStop){
t = time - tStart;
frameDur = 15;
f = timeToFrames(t);
seg = Math.floor(f/frameDur);
seedRandom(seg+1113,true);
rf = Math.floor(random(3));
framesToTime(rf)
}else 0 -
Dan Ebberts
November 6, 2014 at 9:43 pmIt looks like this line:
if (time > tStart && time < tStop){ got mangled by the html conversion. Dan
-
Rafael Braz
November 6, 2014 at 10:17 pmDamn, sorry for that.
Now it’s working, with the sliders on!
I set them to 0/0 and when I want it to start, I keyframe it to 1/3.
But it’s not looping the frames, it just plays once.
Just to summarize it, I’d like to control in keyframes the start and stop points to the frames begin to change randomly in loop mode and then stop whenever I want.
-
Dan Ebberts
November 6, 2014 at 11:12 pmI don’t see how you’re going to be able to get there with sliders, but then again I’m still not quite sure exactly what you’re trying to do. I have a hunch, but it doesn’t quite match up with your description.
Sorry–maybe someone else can jump in.
Dan
-
Rafael Braz
November 7, 2014 at 3:30 pmDamn… I appreciate your help a LOT anyway, dude, you’re awesome.
I’ll try to explain again in case of someone else shows up…
The idea is to be able to control the time remap randomness as an effect, turning it on and off whenever I need.
So it would begin with a specific still frame, then I would turn the ‘effect’ on to make it begins to change the frames randomly and then turn it off back to the specific still frame.
I think it would be better with expressions because otherwise I’ll have to make 3 layers, the first with the specific still frame, the second with expression changing the frames randomly, and then a third layer with the specific still frame.
-
Mathilda Germain
June 24, 2015 at 9:06 amThanks a lot for this expression which is very helpfull for me too !
I have another question : I use this expression in two duplicated comps (same length, samz size …) and I want them to have the same time remap at any time. (This is not what I get, maybe because of the randomseed ?) What is the way to do that ?
Thanks again
Reply to this Discussion! Login or Sign Up