Perry Sheppard
Forum Replies Created
-
This might not be relevant, but if this would be used in a MOGRT, I associated a similar solution to empty csv data, so the highlighted words can be selected within Premiere.
Not sure how much of a performance hit this takes on the MOGRT (I’m still trying to track down why mine is so slow), but it works well and consistently.
-
Perry Sheppard
July 14, 2020 at 11:15 pm in reply to: Using a CSV with time information to determine layer and comp timingsThanks Filip. That did the trick. I was about to resort to TypeArray, but I’m really trying to learn as much as I can before I start relying on pre-built solutions.
Based on the code changes you made, defining ‘time_offset’ cleaned things up quite a bit. I was trying something similar, but wrote it out in longform in each instance and then started adding ‘t1’ to key(n).time everywhere. It also looks like I need to do some additional reading on ‘nearestKey’ because I was trying n = nearestKey(time + t1).index.
Really appreciate the assistance on this. This was the last thing I wanted to add to this project, so I should have a working solution in the next couple of days to help my colleagues out (this isn’t actually part of my job, but they’re so busy right now I wanted to see if I could help them out). Thanks!
-
Perry Sheppard
July 14, 2020 at 8:10 pm in reply to: Using a CSV with time information to determine layer and comp timingsSo, I finally broke down and went with the keyframe control option for a position property on an expression selector. I’ve modified the timing code a little bit to hold on key3 because I want to use this expression from Dan Ebberts for the position bounce (code below).
The timing code (inserted below) and the bounce code work on their own, but I cannot for the life of me get them to work together (six hours of research, tutorials and code attempts and no glory). If there’s a tutorial on something like this, I’d be happy to go that route, but I haven’t been able to find anything.
If there’s a way to integrate the two I’d appreciate the help. Thanks!
transitionLength1 = key(3).time - key(1).time;
transitionLength2 = key(4).time - key(3).time;t1 = startTimeText;
t6 = mySlideEnd - transitionLength2;//if statement for timing
if (time < t1 + transitionLength1)
{
valueAtTime(time + key(1).time - t1);
}
else if (time < t6) {
key(3).value; // hold at key 3 because the bounce continues to key 3 and t6 is slideEnd - transitionLength2
}
else {
valueAtTime(time + key(4).time - t6) //t6 is slide end - transitionLength2
}//bounce statement
freq = 3;
decay = 4.5;n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
}
if (n > 0){
t = time - key(n).time;
amp = velocityAtTime(key(n).time - .001);
w = freq*Math.PI*2;
value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);
}else
value -
Perry Sheppard
July 14, 2020 at 4:26 pm in reply to: Expressions: bounce version of this overshoot Expression Selector code for text?I’m new to coding, but have been working on something similar. Without really getting into your code specifically, I think you need to have at least three, or possibly four time references. The third would indicate when the bouncing stops (I think).
Try this: create a layer and create a simple position movement using two keyframes. Make the movement big and set keyframe 1 to frame 1 and keyframe 2 at frame 15. Add two more keyframes at 4 seconds and 6 seconds.
Go to Dan Ebberts Motionscript bounce and overshoot page and grab the last expression on the page and drop it onto your position property. You should see the bounce and overshoot working.
Now, if you drag keyframe 3 to 2 seconds, you should see the bounce stop abruptly at key3. I’m still working on the problem myself, so no solution to offer, but that might help you with yours.
-
Perry Sheppard
July 13, 2020 at 11:23 pm in reply to: Adding several text animation options to a dropdown controlThanks Filip. That worked like a charm! I entirely forgot about the ‘amount’ attribute (still learning). This was exactly what I was looking for. I’ve provided a few animation choices and it’s working perfectly. Fortunately, most of the animations only modify a single attribute, so it keep the code copying to a minimum.
-
Thanks Filip. I saw your response on this string about using stroke as a faux-bold solution, which works just fine for me. This one is for my wife, so I think it’s reasonable to say I can ask her to type the words she wants to be highlighted using the shift key :).
-
I found this expression (see below) on page 64 of JARLE LEIRPOLL’s Free eBook on Making MOGRTs. He references this thread as the source of the base for the expression.
Here’s the overview from the eBook:
“Use two text layers: one named Text and one named Highlighted Words. Add an expression selector to the Text layer by choosing Animation > Add Text Selector > Expression. Then add a Color animator by choosing Animation > Animate Text > Fill Color > RGB. Change Based On to Words.
Alt-click the stopwatch for Amount and paste the code (below). Now start typing numbers separated by plus signs in the Highlighted Words text layer. The words at those numbers in the main Text layer will change color.”
I’ve been trying to modify the expression to also change the highlighted words to uppercase and bold/fauxbold, but the structure is a little beyond my abilities.
Any help would be appreciated.
string = thisComp.layer("Highlighted Words").text.sourceText.split("+");
result = 0;
for (i = 0; i < string.length; i++){
if (textIndex == parseInt(string[i],10)){
result = 100;
break;
}
}result -
Perry Sheppard
July 12, 2020 at 9:41 pm in reply to: Adding several text animation options to a dropdown controlHi Filip,
You probably noticed I got the timing expression working. Thanks for the help and teaching me the value of time (bad pun, but it was right there).
The animators are controlling several properties and not all are shared. I anticipate that if I go the route of writing all of the animations out using a single ‘animator’ and switching with dropdowns that it’s going to require a fair bit of code gymnastics, but if that’s my only option, then I’ll do it.
My thought was that I would set expressions out for all of the properties needed across all of the animations and for those properties that didn’t need to be change for specific animations, I would simply apply the ‘value’ or default values to them.
-
Perry Sheppard
July 12, 2020 at 7:15 pm in reply to: Adding several text animation options to a dropdown controlMy other thought was to use the single animator and define multiple animations within it using an expression and if/else statements.
The code below defines the first animator only and is in the ‘Offset’ property in the range selector. I would need to add a fair bit of code in a number of properties to make this work with multiple selectors, but if that’s the only way to accomplish this, then I’ll look take a stab at it.
If anyone has suggestions on a simpler way using multiple animators, please let me know.
//define timing for animatorsmySlideStart = (comp("Master").layer("SlideContent2.csv")("Data")("Outline")("SlideStart")("SlideStart" + " " + thisComp.name));
startTimeText = (comp("Master").layer("SlideContent2.csv")("Data")("Outline")("Text1Start")("Text1Start" + " " + thisComp.name)); //only need to change these values for new layers
endTimeText = (comp("Master").layer("SlideContent2.csv")("Data")("Outline")("Text1End")("Text1End" + " " + thisComp.name)); //only need to change these values for new layers
mySlideEnd = (comp("Master").layer("SlideContent2.csv")("Data")("Outline")("SlideEnd")("SlideEnd" + " " + thisComp.name));transitionLength1 = 2; //this changes based on the animator
transitionLength2 = 0.5; //this changes based on the animatorvalue1 = -40; //this changes based on the animator
value2 = 100; //this changes based on the animator
value3 = 100; //this changes based on the animator
value4 = 100; //this changes based on the animatort1 = startTimeText; //textStart
t2 = startTimeText + transitionLength1; //textIn
t3 = endTimeText - transitionLength2; //textOut which aren't needed because the out timing is the slide out not the text out
t4 = endTimeText; //textEnd which aren't needed because the out timing is the slide out not the text out
t5 = mySlideStart; //slideOn
t6 = mySlideEnd - transitionLength2; //slideOut start the slide out transition
t7 = mySlideEnd; //slideOff//end timing for animator definitions
//if statement for timing
if (time < t1 + transitionLength1) {
linear(time, t1, t2, value1, value2) //the first transition} else if (time < t4 - transitionLength2) {
linear(time, t2,t3, value2, value3); // hold at key 2} else {
easeOut(time, t6, t7, value3, value4)
} -
Perry Sheppard
July 10, 2020 at 7:58 pm in reply to: Using a CSV with time information to determine layer and comp timingsOh. I think I get it now. Because the property ‘time’ is constantly being evaluated, and if/else statement can be used to change the value of a layer multiple times.