Search found 319 matches

by Dan Ebberts
November 3rd, 2011, 8:04 pm
Forum: Expression Discussion
Topic: Car Wheels Moving Backwards
Replies: 3
Views: 4318

Re: Car Wheels Moving Backwards

Just add a minus sign in front of the expression to get it to rotate the other way:

-thisComp.layer("Bug Control End").transform.position[0]


Dan
by Dan Ebberts
November 3rd, 2011, 6:26 am
Forum: Expressions Tutorials
Topic: Use sampleImage() to create a color picker
Replies: 6
Views: 26756

Re: Use sampleImage() to create a color picker

I think that would be like this (not tested):

target = thisComp.layer("Color_gradient");
target.sampleImage(target.fromWorld(toWorld(anchorPoint)), [0.5,0.5], true, time)


Dan
by Dan Ebberts
October 31st, 2011, 8:21 pm
Forum: Script requests
Topic: All Solos off
Replies: 9
Views: 6163

Re: All Solos off

Like this: // turn off solo on all layers { var myComp; app.beginUndoGroup("Turn Off All Solos"); for (var i = 1; i <= app.project.numItems; i++){ if (app.project.item(i) instanceof CompItem){ myComp = app.project.item(i); for (var j = 1; j <= myComp.numLayers; j++){ if (myComp.layer(j).solo) myComp...
by Dan Ebberts
October 31st, 2011, 1:12 pm
Forum: Script requests
Topic: All Solos off
Replies: 9
Views: 6163

Re: All Solos off

Ah yes, good catch. Try this version: // turn off solo on all layers { var myComp; for (var i = 1; i <= app.project.numItems; i++){ if (app.project.item(i) instanceof CompItem){ myComp = app.project.item(i); for (var j = 1; j <= myComp.numLayers; j++){ if (myComp.layer(j).solo) myComp.layer(j).solo ...
by Dan Ebberts
October 31st, 2011, 11:50 am
Forum: Script requests
Topic: All Solos off
Replies: 9
Views: 6163

Re: All Solos off

This should do it: // turn off solo on all layers { var myComp; for (var i = 1; i <= app.project.numItems; i++){ if (app.project.item(i) instanceof CompItem){ myComp = app.project.item(i); for (var j = 1; j <= myComp.numLayers; j++){ myComp.layer(j).solo = false; } } } } Dan
by Dan Ebberts
October 24th, 2011, 10:04 am
Forum: Expressions Library
Topic: Current Comp to Text Layer Source
Replies: 5
Views: 10860

Re: Current Comp to Text Layer Source

If I were doing it, I would restrict the slider values to legal layer indices like this:

Code: Select all

firstLayer = Math.min(Math.max(Math.round(effect("First Layer")("Slider")),1),thisComp.numLayers);
lastLayer = Math.min(Math.max(Math.round(effect("Last Layer")("Slider")),1),thisComp.numLayers);
by Dan Ebberts
October 20th, 2011, 9:54 am
Forum: Expressions Library
Topic: Current Comp to Text Layer Source
Replies: 5
Views: 10860

Re: Current Comp to Text Layer Source

I don't understand the first part of your question. If you have multiple layers active at the same time, the one at the top of the layer stack is the one that will be visible. Don't you want the info for that one? To restrict the range you just need to change: for (i = 1; i <= thisComp.numLayers; i+...
by Dan Ebberts
October 19th, 2011, 2:36 pm
Forum: Expression Discussion
Topic: including external text file in an expression
Replies: 6
Views: 9158

Re: including external text file in an expression

If I understand what you're asking, you just need to separate the text lines in your file with backslash+r, like this:

"Text Line 1\rText Line 2\rText Line 3"


Dan
by Dan Ebberts
October 19th, 2011, 1:21 pm
Forum: Expression Discussion
Topic: including external text file in an expression
Replies: 6
Views: 9158

Re: including external text file in an expression

Try it this way:

$.evalFile("/c/Expressions/text.txt");

I tried it with a text.txt file containing this:

"test"

and it seems to work fine.


Dan
by Dan Ebberts
August 23rd, 2011, 11:31 am
Forum: Expression Discussion
Topic: Can I check if a layer has an effect?
Replies: 2
Views: 4099

Re: Can I check if a layer has an effect?

Here's an example that should count the layers with the checkbox:

Code: Select all

n = 0;
for (i = 1; i <= thisComp.numLayers; i++){
  if (i == index) continue; // skip myself
  try{
    thisComp.layer(i).effect("isObject")("Checkbox");
  }catch (e){
    continue;
  }
  n++;
}
n
Dan
by Dan Ebberts
August 15th, 2011, 9:46 pm
Forum: Scripts Discussion
Topic: Check OS system?
Replies: 2
Views: 2824

Re: Check OS system?

Something like this should work:

var isWindows = $.os.indexOf("Windows") != -1;

Dan
by Dan Ebberts
August 4th, 2011, 9:11 am
Forum: Scripts Discussion
Topic: Option (Alt) replace method
Replies: 2
Views: 2723

Re: Option (Alt) replace method

I think you're going to have to do it the long way. That is, get the usedIn array for the comp you want to replace, and for each comp in that array, go through all the layers looking for layers whose source is the comp to be replaced--then do a replaceSource() , pointing those layers to the new comp...
by Dan Ebberts
July 17th, 2011, 5:06 pm
Forum: Expression Discussion
Topic: Pseudo object 'awareness' expression
Replies: 2
Views: 3937

Re: Pseudo object 'awareness' expression

Try this with all the layers but the left-most. It assumes the left-to-right order of the layers corresponds to a top-to-bottom order in the layer stack. If the left-most layer isn't Layer 1, you'll need to edit the first line. Also, it won't work right if the anchor points aren't centered on x. fir...
by Dan Ebberts
May 9th, 2011, 12:47 pm
Forum: Expression Discussion
Topic: global random number / duration?
Replies: 1
Views: 3276

Re: global random number / duration?

Put your random duration calculation in a Slider Control and have all your other expressions reference that.


Dan
by Dan Ebberts
April 24th, 2011, 8:19 pm
Forum: Script requests
Topic: Remove All Effects fro all Layers
Replies: 3
Views: 5221

Re: Remove All Effects fro all Layers

It you're trying to remove the Effects property group rather than the individual effects. You might have more luck with this: { var myComp = app.project.activeItem; var myEffects; for (var i = 1; i <= myComp.numLayers; i++){ try{ myEffects = myComp.layer(i).Effects; for (j = myEffects.numProperties;...