Forum Replies Created
-
Worked like a charm, thanks a bunch!
-
Michael Müller
November 27, 2019 at 1:56 pm in reply to: ExtendScript: Changing a value that I can’t believe is read-onlyI made the mistake of trying to change the value by just typing in offset.value = 20 instead of offset.setValue(20). Perfect reply, now I know exactly how to continue. Dan gave me a perfect answer in the Adobe forum, where I asked the question as well.
Thanks a bunch!
Thread closed
-
Michael Müller
January 10, 2019 at 5:21 pm in reply to: Trigger Pre-Comped Animation through ConditionI’m glad it works now. In my attempt of understanding it, I was able to shorten it quite a bit, while maintaining functionality. This leads me to a question:
I was able to completely get rid of the if statement. All I was left with, was the while statement that was included in both the “then” and the “else” of this if-statement. Did you include it to have the case of re-triggering covered? I couldn’t really wrap my head around it.
The code now looks like this:
a = thisComp.layer("Bubble L").transform.position;
b = thisComp.layer("Trace").transform.position;
d = 20; // duration of animation in frames
t = framesToTime(d);
while (d > 0){
d--;
t = framesToTime(d);
if (b.valueAtTime(time-t)[0] < a.valueAtTime(time-t)[0]){
break;
}
}
t
Thanks,
Michael
-
Michael Müller
January 9, 2019 at 8:47 pm in reply to: Trigger Pre-Comped Animation through ConditionEnd of the animation > I thought that maybe you could reset the time value to zero again, once 20 Iterations of the loop (and 20 frames of the animation) passed.
Re-triggered while the animation is running > in this case, I’m pretty sure that situation will never occur. If it would be just one extra line of code, I’d prefer to not interrupt any current animation. But as I said, it’s probably not necessary.
Is it really complicated? This starts to begin looking like a contract. You have a tip jar, do you?
Thanks,
Michael
-
Michael Müller
January 9, 2019 at 1:55 pm in reply to: Trigger Pre-Comped Animation through ConditionYes, I looked at it and it clearly shows what is happening. I now understand how the loop is driving the animation. Now it almost works. Unfortunately, the loop stops as soon as the condition is false again ant the time value drops to zero before the animation is finished.
I thought it would help me to count the number of Iterations of the loop while the condition is true. I thought I could somehow force the loop to continue until a certain number of Iterations is reached. Here is what I got:
curFrame = 0;
frameCount = 0;while (curFrame <= timeToFrames(time)){ if (b.valueAtTime(framesToTime(curFrame))[0] <= a.valueAtTime(framesToTime(curFrame))[0]){ frameCount++; } curFrame++; } Returning frameCount shows the number of Iterations, the number of completed frame-steps before the animation stops I don't know how to force the loop to continue. I thought I could reset the number by adding a limit and then limiting the number of Iterations the loop can have to not make it crash. Does that make sense? Thanks, Michael
-
Michael Müller
January 9, 2019 at 12:05 pm in reply to: Trigger Pre-Comped Animation through ConditionAfter a few hours of taking this code apart and trying to understand it, I think I an idea of what’s going on. Definitely at least learned few things.
Now there is still one problem, which is what you talked about earlier. The Animation gets triggered when the condition is true, not when it becomes true, which is to say that once the condition becomes true, the time value of the animation is stuck on 0 until the condition is no longer true again.
what am I missing?
Thanks,
Michael
-
Michael Müller
January 8, 2019 at 8:54 pm in reply to: Trigger Pre-Comped Animation through ConditionFirst of all: thank you very much. I think I understand whats happening. In my Intention to truly learn from you, I have a few questions. I’ll try to recap what I do understand as well. Correct me if I am wrong.
t0 = time – thisComp.frameDuration; // you’re setting t0 equal to one frame?
why is the “t0” in a.valueAtTime(t0). I never really understood this fully. I understand that if you have property.valueAtTime(time-1) you delay it by 1 second, and I do understand that in this line:
if (b.valueAtTime(t0)[0] >= a.valueAtTime(t0)[0]){
you are comparing two frames by their value in time but I never knew exactly what it means to have something stand in parenthese after a command like this. It seems obvious but I can’t grasp what it means in general. (I’d google it but I don’t know the name of what I’m looking for)
break interrupts the time loop. I get that. To my eye it looks like thats already it but its obviously not and what is following I just cannot grasp:
t0 -= thisComp.frameDuration; // doesn’t thisComp.frameDuration equal one frame? Wouldnt that mean that you’re setting one frame equal to.. uhm.. one frame-one frame? It’s obviously not a number but what is it then?
}
t0 += thisComp.frameDuration; // 1 = 1+1 ??
t = time – t0; // what is t0 equal in the end? I’ve never seen a nested condition like thisI see it’s necessary for completing the code but I just cannot understand what it means.
-
Michael Müller
January 8, 2019 at 7:18 pm in reply to: Trigger Pre-Comped Animation through ConditionI have two layers, AA and BB, randomly swinging from left to right. I am comparing the positions of both and d to become true when the x value of BB is lower than the x value of AA.
I am not very familiar with try and catch, but I assume you would have to have a condition that doesn’t change it’s value while it’s true for the first method you mentioned, am I right?
I think I would have to set up some kind of loop, which goes through every frame until it finds one that is different.
I am aware that I would need
frame = Math.round(time/thisComp.frameDuration);
and some if statement with frame– as the else
but I am not very sure. This seems way more complicated than I thought.Maybe you can give me another hint, there is something I am missing here.
Thanks,
Michael
-
Michael Müller
January 8, 2019 at 6:47 pm in reply to: Trigger Pre-Comped Animation through ConditionI see what you are saying, Indeed I only want to trigger it when d becomes true, once for every time.
How do I return the most recent time when d becomes true? I could only figure out how to return the time-value constantly until d is not true anymore but I guess that doesn’t help me much.Thanks,
Michael
-
Michael Müller
January 1, 2019 at 11:40 pm in reply to: After Effects crashing when I open use Designer with ParticularThe designer in particular is very unstable and crashes all the time, even on my machine, which is pretty high end.
If you want to learn how to use particular, search for tutorials online and just use the regular controls inside the effect. honestly I’m not a huge fan of the designer, though it gets better with every update. You won’t miss out on much though.
I’d recommend you make free at least 16gb of ram for ae to use. Otherwise youre going to run into issues very quickly when using effects like particular.Michael