Forum Replies Created
-
If I understand you correctly, you want to display a selection of words rather than numbers? I have modified the expression below to include an array of words. The last line uses the integer number generated by the linear function to select one of the words from the ‘words’ array.
Note that the first element in the array is referenced as ‘0’ and the (in this case) the last one ‘9’. Such that:
words[0] will return ‘One’
words[9] will return ‘Ten’The endVal in this case is the last reference of you words array you want to display, and the beginVal is the first reference.
words=['One','Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten'];
startT = 0;
endT = 4;
beginVal = 0;
endVal = 9;
t = linear(time,startT,endT,beginVal,endVal);
words[Math.floor(t)]Declan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”
-
The linear function evaluates the current time and returns a scaled value based on the parameters you have supplied. In this example, when time=0 (startT) the count starts and will start at 0 (beginVal). It will then evaluate, in a linear fashion, the next value to display until it reaches 4 seconds (endT) where it will display 100.
So if you wanted the count to start at 3 seconds and finish at 10 seconds, you would put startT=3 and endT at 10.
The t.tofixed(0) ensures that no digits of precision are displayed. i.e. numbers after the decimal point (you could use Math.floor(t) to achieve the same thing in this instance).
To add a % sign on the end, alter the expression as below.
startT = 0;
endT = 4;
beginVal = 0;
endVal = 100;
t = linear(time,startT,endT,beginVal,endVal);
Math.floor(t) + '%'
Declan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”
-
Amazing, all working beautifully now.
Thankyou
Declan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”
-
That seems to work here, and if I add a code block, but it doesn’t work in the expressions box that is on the After Effects Expressions post form.
\
\dDeclan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”
-
Yes sorry I think the COW removed a backslash
before the ‘d’ put a backslash
/d+/i.exec("layer123")Declan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”
-
You can use regular expressions to extract a number from a string.
A simple example below with return 1 or more consecutive numbers, such that if your string was “Layer123” it would return 123
Regular expressions are very powerful to apply selection patterns. Note that the example below will return the first set of numbers it encounters.
/d+/i.exec("layer123")Declan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”
-
And apple dropped Shake at a moments notice. It’s annoying that the newer models don’t support the older software. I think this is more of a marketing decision rather than a technical one.
Declan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”
-
Declan Smith
November 4, 2013 at 3:23 pm in reply to: Trapcode form / particular emanating from alpha edgeGreat, thank you, meant to send this last week. The bit I was missing was setting the layer to 3D. All working now.
Declan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”
-
Declan Smith
October 31, 2013 at 12:36 pm in reply to: Analog clock with inertial bounce on second handI did a similar thing on the clock hand of my VTClock tutorial. The expression below is the rotation control for the second hand. The second hand only moves on the whole second, but overshoots by a small amount, then one frame later, goes back to where it’s supposed to be. I converted time to frames to control this. Note that you may need to change the statements to suit your own frame rate:
ttf=timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false);
compFrameRate=25;
angle=Math.floor(ttf/compFrameRate)*6;
if (ttf % compFrameRate == 0) {
angle+=.5;
} else if (ttf % compFrameRate ==1) {
angle-=.5;
}
Declan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”
-
Declan Smith
October 20, 2013 at 7:11 am in reply to: Why do videos on the same video track eat eachother when you overlap them?Put simply, it’s bad user interface design. Final Cut Pro is exactly the same (I refer to version 7).
What you achieve in vegas when dragging video over the top is a cross dissolve which in video editing terms is generally seen as a bad thing, however, from an audio perspective, cross dissolves make perfect sense.
From a user point if view, the act of dragging a clip over another should result in one of two actions: either splice the clip underneath (as is what happens in PP) or blend (dissolve) which is what happens in Vegas. It ought to configurable or controllable via a modifier key or setting. For me the perfect world would be to control both independently so that audio would dissolve and video would cut.
Interestingly enough, if you work in Adobe Audition (Adobes audio editor), then dragging an audio clip over another audio clip results in a dissolve, so what you have here is an inconsistent approach to UI design as you don’t get this behaviour in Premier Pro.
I use both Adobe Premiere and Final Cut Pro (7) having switched to the Mac platform 4 years ago, and still wish that these programs were as intuitive as Sony Vegas. It’s not surprising to know that Sony Vegas started life as an audio editor, thus dissolves are natural and they just applied the same process to video layers.
Declan Smith
https://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase“it’s either binary or it’s not”