Decrease the opacity of the layer with the Distance from the camera

Is there a way to automatically decrease layer opacity that layer away a camera?

We will break down the process of thought, of expression and see if we can make it work for you.

First of all, you must measure the distance between the camera and the layer. The Expression Language Menu effects has a under vector math method which measures the distance between two points, we can use. Use the camera to a point and the position of the layer on the other and we have the first number.

Now we must decide what we want the opacity to what concerns the distance. When the layer is the same distance from the camera the zoom value will be called the equivalent of a scale of 100%. It is perhaps a good place to have the layer is completely visible. This distance is easily implemented by assigning the fully visible distance to the Active camera zoom value. Then we have to decide how far the layer must be when it is completely invisible (opacity = 0). Personally, I think that the best way to proceed is to use a multiplier for the zoom value. 4 X with most lens settings is a nice distance.

To configure the relationship between the distance and the maximum opacity, you can use one of the methods of Interpolation in the Expression Language Menu. We will use the method with the maximum and minimum values.

We'll put that together in an expression. The two methods to use are

length (point1, point2)

linear (t, tMin, tMax, value1, value2)

Set some variables for each of the values and we're done:

point1 = thisComp.activeCamera.position;
point2 = position;
tMin = thisComp.activeCamera.zoom;
tMax = tMin * 4;
value1 = 100;
value2 = 0;

t = length(point1, point2);
easeIn(t, tMin, tMax, value1, value2)

If you really want to get fancy then you can add a transformation from layer space to the camera and the layer so that the expression might work even with or without layers relative to the camera and/or the layer. ToWorld changing looks like this:

point1 = thisComp.activeCamera.toWorld([0,0,0]);
point2 = thisLayer.toWorld(anchorPoint);

Furthermore, I use usually more descriptive and shorter names for variables, but thought that it would make it easier to understand what was going on in the expression. I use also usually Active camera for my expressions rather than thisComp.layer ("camera 1") because it works little whatever you named your active camera.

Tags: After Effects

Similar Questions

  • Animate the opacity of the layer with the expression of the music on / off?

    Hi all

    I seek to animate the opacity of a layer according to an Audio Amplitude of entry. For example, when a kick in the song occurs with a value of 50 slider I want the active layer and stay until a kick from value 50 turns.


    This is what I currently use but it shuts down after reaching the value. Is it possible to write an expression that connects it to a checkbox control?


    Music = thisComp.Layer ("audio amplitude"). Effect ("the two Channels")("Slider");

    Linear (Music, 45, 70, 0, 200)


    Thank you in advance for your help!


    -Sean Bradord

    This was the solution:

    Use the BPM here counter:

    http://www.Motionscript.com/design-guide/audio-count.html

    but replace the last line with this:

    If (n %2) 100 0 otherwise)

  • Is it possible to get the layer, layerset and layer with status layerset...!

    Hello world!

    Is it possible to get the layer, layerset and layer with the status layerset. Because I met a big problem out of it.

    I have a single PS document which is contain the collection of layer, layer with layer games collection. I need apply the function for each layer and layers and each layer games with of layerset.

    I also tried a code, but its error getting. Please help me out of this code...

    -yajiv

    #target photoshop

    app.bringToFront ();

    level of $= 2;

    var app.activeDocument = docRef;

    Journal of the var ="";

    var x = 0;

    var n = number (docRef.layers.length) - 1;

    for (i = 0; i < n; i ++) {}

    var tm = String (docRef.layers [i]);

    var isLayer = tm.lastIndexOf ("ArtLayer");

    var isLayerSet = tm.lastIndexOf ("LayerSet");

    {if(isLayer!=-1)}

    Check_LayerStructure (DocRef.Layers [i], 'Layer');

    }

    {if(isLayerSet!=-1)}

    Check_LayerStructure (DocRef.layerSets, "LayerSets");

    x = x + 1;

    }

    }

    function Check_LayerStructure (objLayer, objflag, x) {------}

    {if(objflag=="Layer")}

    LayetStructure (objLayer, objLayer.name, BlendMode.NORMAL, 100, 100, 0, true, 'Layer');

    }

    else {if(objflag=="LayerSets")

    LayetStructure (objLayer [x] objLayer [x] .name, BlendMode.PASSTHROUGH, 100, 100, 1, true, 'together');

    m = Number (objLayer [x] .layers. Length)

    for (j = 0; j < m; j ++) {}

    var tm = String (objLayer [x] .layers [j]);

    var isLayer = tm.lastIndexOf ("ArtLayer");

    var isLayerSet = tm.lastIndexOf ("LayerSet");

    {if(isLayer!=-1)}

    Check_LayerStructure (objLayer [x]. Layers [j], 'Layer');

    }

    {if(isLayerSet!=-1)}

    Check_LayerStructure (objLayer [x] .layerSets, "LayerSets", x);

    }

    } / / Loop Layerset

    } / / I loop For

    } //Function loop

    function LayetStructure(layerRef,L,bMode,Opt,fillOpt,S,layVisible,Lref) {}

    {if(layerRef.BlendMode!=bMode)}

    If (confirm (L + Lref + "belend mode was bad...!)) \n"+"do you want to change...? »)) {

    layerRef.blendMode = bMode;

    Journal = Journal + "-" + L + Lref + "belend mode has been changed...! \n\n ";

    e = 1;

    }

    }

    {if(layerRef.Opacity!=opt)}

    If (confirm (L + Lref + ' opacity has been "+ Math.round (layerRef.opacity) +"%...! ")) \n"+"do you want to change...? »)) {

    layerRef.opacity = Opt;

    Journal = Journal + "-" + L + Lref + ' opacity was changed to 100...! \n\n ";

    e = 1;

    }

    }

    If (layerRef.fillOpacity! = fillOpt & & S == 0) {}

    If (confirm (L + Lref + ' Fill has been "+ Math.round (layerRef.fillOpacity) +"%...! ")) \n"+"do you want to change...? »)) {

    layerRef.fillOpacity = fillOpt;

    Journal = Journal + "-" + L + Lref + ' fill has been changed to 100...! \n\n ";

    e = 1;

    }

    }

    {if(layerRef.visible!=layVisible)}

    If (L + Lref + ' left eye...! ") \n"+"do you want to change...? ») {

    layerRef.visible = layVisible;

    Journal = Journal + "-" + L + Lref + ' eye was turn on...! \n\n ";

    e = 1;

    }

    }

    }

    Code of responsible for the action would naturally faster, but if you should be more comfortable with the DOM code, it could be useful to you.

    #target photoshop

    var theLayers = collectLayers (app.activeDocument, []);

    Alert (theLayers.join ("\n"));

    function to collect all the layers.

    function collectLayers (theParent, allLayers) {}

    If (! allLayers) {var allLayers = new Array}

    else {};

    the number of var theParent.layers.length = - 1;

    for (var m = number; m > = 0; m-) {}

    var theLayer = theParent.layers [m];

    apply the function of games of layers;

    If (theLayer.typename == "ArtLayer") {}

    allLayers.push ([theLayer, theLayer.blendMode, theLayer.opacity, theLayer.fillOpacity])

    }

    else {}

    allLayers = (collectLayers (theLayer, allLayers))

    This line includes layer groups;

    allLayers.push ([theLayer, theLayer.blendMode, theLayer.opacity, theLayer.fillOpacity]);

    }

    };

    return allLayers

    };

  • I have photos I want to decrease the dpi on but can not understand how with the Gallery Windows. I have Windows Vista operating system.

    I have photos I want to decrease the dpi on but can not understand how with the Gallery Windows. I have Windows Vista operating system.

    I have photos I want to decrease the dpi on but can not understand how with the Gallery Windows. I have Windows Vista operating system.

    ===============================================
    You can resize a picture in WLPG but if you want to change the .dpi you
    need a different application.

    Information about resizing...
    Right-click on one or more selected inches... Choose... "Resize" in the menu.
    Choose a format, access a folder to save in the left click the ' resize and
    Save "button. (I suggest that you save the photos resized in a new folder
    to prevent the replacement (replacement) the originals)

    Take a look at the following link:

    Resizing Photos in Windows Live Photo Gallery
    http://blogs.msdn.com/PIX/archive/2007/11/30/resizing-photos-in-Windows-Live-Photo-Gallery.aspx

    In addition, the free software IrfanView can change dpi. Simply open a photo in IrfanView
    and go... Image / information. Enter the resolution you want in the resolution
    fields and on the left, click change. Then go to... File / save as... and save
    your photo altered with a new name.

    IrfanView
    http://www.software.com/IrfanView
    (Download plugins too)
    http://www.software.com/IrfanView-plugin

    John Inzer - MS - MVP - Digital Media Experience - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • Reduce the opacity of a layer, then export as .png

    Hi all. I would like to create a script (I don't think I can do it in the form of action) in order to reduce the opacity of a layer of 3%, and export the file as a .png. Is this possible? I saw where it would be possible to define a finite number, or 97%, then export, but I hoped that there could be a chance to write one this way. Any help is welcome. I created before but never the scripts of Ps actions.

    var d = activeDocument
    var r = d.activeLayer
    var op = Math.round (r.opacity)-3
    r.opacity = op
    alert(op)
    
  • I can't move a layer with the mouse.

    I can't move a layer with the mouse. Only using the arrow. This happened two days ago and could not get the right set of return I guess. Until I'm able to move a layer with the mouse and arrow keys. When you move the layer with the mouse you he almost jumps back to the original space. I'm only using a bluetooth mouse, wired keyboard with a macbook from apple.

    Photoshop Elements does not respond when you use Mac OS X 10.10 editing tools

  • Photoshop opens the dialog box when you try to fill a layer with locked transparent pixels

    This script should set the layer to lock transparent pixels and then fill the layer with a color. She is doing this, except when it is in the filling phase, it opens the dialog box fill, and you have to hit OK.

    If you omit the transparent pixel line, it works as not expected, no dialog boxes.

    Is there a way to remove the box? Or I'm doing something wrong, which is causing the box to open?

    #target photoshop
    app.bringToFront();
    
    doc = app.activeDocument;
    doc.artLayers[0].isBackgroundLayer = false;
    doc.artLayers[0].transparentPixelsLocked = true;
    app.activeDocument.selection.fill(app.foregroundColor); 
    

    Not sure why this is happening.

    But I would recommend blocking the above and using the AM code for a fill that pays tribute to transparency.

    #target photoshop

    app.bringToFront ();

    doc = app.activeDocument;

    doc.artLayers [0] .isBackgroundLayer = false;

    doc.activeLayer = doc.artLayers [0];

    // =======================================================

    idFl var = charIDToTypeID ("Fl");

    var desc18 = new ActionDescriptor();

    var idUsng = charIDToTypeID ("Usng");

    var idFlCn = charIDToTypeID ("FlCn");

    var idFrgC = charIDToTypeID ("FrgC");

    desc18.putEnumerated (idUsng, idFlCn, idFrgC);

    var idOpct = charIDToTypeID ("PCT");

    var idPrc = charIDToTypeID ("#Prc");

    desc18.putUnitDouble (idOpct, idPrc, 100.000000);

    TSM var = charIDToTypeID ("Md");

    var idBlnM = charIDToTypeID ("BlnM");

    var idNrml = charIDToTypeID ("Nrml");

    desc18.putEnumerated (TSM, idBlnM, idNrml);

    var idPrsT = charIDToTypeID ("PrsT");

    desc18.putBoolean (idPrsT, true);

    executeAction (idFl, desc18, DialogModes.NO);

  • Resize the layer with smart filter without affecting the Smart Filter layer appearance

    I made a wax seals on photoshop with lots of embossing, bevelment and a dynamic filter. It's done and I just need to make it smaller so it fits well on my certificate. When I resize (Ctr + T) it appears a messgae which reads:

    ______________________________________________

    Adobe Photoshop CS6 extended

    "The dynamic filters applied to the layers contained in this group will be disabled at the temprarily while conversion is in preview. They will be applied after commit the transformation. »

    Ok

    [] Do not show

    ______________________________________________

    I click OK and I resize the layer with free transform, and then press ENTER. The layer is resized, but my smart filter that cretaes affect a shower around the joint is completely distorted.

    How to resize my layer with smart filter without affecting the appearance of dynamic filter of the layer

    Right-click on the name of the layer to smart object in the layers panel to get the menu below. Choose "Convert to Smart Object" to encapsulate the er and its smart filter and Layer Styles within a new KIND that can be resized without appearance changes.

  • Newbie question - how to move a layer with the effect of deformation without changing the distortion?

    For example, to move a layer with an effect of training as well as his training center, so I don't have to make the corresponding calculations Center ripple and position.

    GSIDesign wrote:

    ... the two methods roughly the same result but are very different when you move the training center now.

    Thanks for the tip of the expression.

    If the mask is exactly the same size and shape as the shape layer, then you should get the same results.

  • How to get the background color of a layer with AE SDK

    Hello

    I try to get the background color for my current layer, but I can't seem to find how do.

    I don't want background color, background color of the application, but the color that shows through, if I set the alpha of my pixels to 0.

    For example, assume that the background of the composition is black, I put a solid top, green then put a picture on top of the solid and apply my pug-in the image.

    If I set the alpha to zero in my plug-in, green solid will be displayed.

    So I want to be able to know that my background is green.

    I tried to use PF_AppGetBgColor(), but which returns the background color of the application, which isn't green in this example.

    If you want more details on what I want to do, I plug P1 which affects some 0-alpha pixels. Above it, I apply an another plugin P2 which reveals alpha-0 pixels by mixing with little color.

    What is happening now is that the output is color of the original image, mixed with the color of P2 (because only modified P1 alpha pixels).

    What I want is to have the color through the transparent pixels of P1 display mixed with the color of P2.

    To do this, I would like to be able to set the color of pixels 0-alpha in the color of the background in P1.

    Sorry for the question long.

    Thanks for your suggestions.

    Hello nicolas.

    If I understand it, that you try to get the buffer of image layers composited under the layer with your effect.

    If that is correct, then I fear that it is almost impossible to do.

    When AE makes a composition he doesn't it down. He's trying to do the opposite in fact.

    Why? because if at some point, the buffer is completely opaque, then he has no need to make what's below.

    further more, checked the diaper changing the rendering order, and many other things affect the rendering of the layers order.

    In addition, there is no API to access buffers intermediaries comp. just the end result.

    the closest you can get than without turning of the world, is to use AEGP_GetCompBGColor().

    that would be useless to you that the image is not composite on that color, unless it is the model being saved to the file.

    so why I said 'almost impossible '?

    You can transform the world.

    You can write a type ECAP 'craftsman '. (look at the example of 'arti')

    These plug-ins make comps (instead of the "advanced3D" converter)

    a craftsman has results intermediaries comp, because he is the one doing the rendering.

    so now you can have your craftsman save the buffer, you need and deliver it to your effect.

    I must warn you that this is very very very difficult.

    Another possible solution is to create a copy of the model resides in your effect,

    erase all the layers that has the image you need and make that reproduces model using AEGP_GetReceiptWorld().

    If you use this method, you must supervise the original model and apply changes to the copy.

    Yes, it's too difficult to do.

    you could make a change in the strategy and apply your effect to an adjustment layer instead.

    the entry for the adjustment layer is the buffer underlying layers.

    Then, you could get the original sources you want to treat using checked layer params.

    the last solution I can think uses the expression of sampleImage() on a hidden parameter.

    This will give you any layer's pixel data in the model, but not the composite of the underlying layers.

    Maybe if you tried sampling adjustment layers post effects... I don't know. you need to try.

    This method is very slow and is also limited to expire, so you can't get a large number of pixels.

    the expression simply fails.

    I hope that this was not all bad news for you.

    Maybe you said more about the plug-in you develop I could come up with a better plan.

    :-)

  • Merge a layer with the background

    Is it possible to merge a layer with the background? I mean, suppose that the background does not yet exist and I have a series of layers on top of this transparent background. How can I go on the fusion of one or more of these layers with the background without flatten the whole image?

    to convert a normal layer into a background layer, you will need to select and go to the layer-> New-> layer bottom. As far as I know, this is the only place where you can do. If you want to do a bottom layer of multiple layers, you must select the layer and go first to layer-> layer blending to merge the layers into a single layer

  • My DVD has stopped working "cannot read DVDs Please decrease the current resolution.

    Original title: DVD

    My DVD has stopped working - error that says: cannot read DVDs Please decrease the current resolution and ensure that the connection of display type is taken care... Help!

    Hello

     
    What program you're using to play the DVD? Mention the name of the program?
     
    Try to play the DVD with Windows Media Player , and let me know if you get an error message.
    Play a CD or DVD in Windows Media Player
     
    Response with more information to help you.
  • HP ac024 tx: can not increase or decrease the brightness

    Hi, I installed Win 7 64 bit on my computer. Im not able to see the options to increase or decrease the brightness on my PC. Please help me with this, the question seems low, but could do nothing. I installed all the drivers available, but cannot find the display drivers for my model. I tried some google steps for... anything!

    Arungraj22 wrote:

    ... question seems small, but could do nothing. I installed all the drivers available, but cannot find the display drivers for my model...

    Hello

    Your machine came with FreeDOS, this question is not small:

    http://support.HP.com/SI-en/document/c04746482

    It uses Intel HD Graphics 4400. All the drivers for this machine should be on the following link:

    http://support.HP.com/in-en/drivers/selfservice/HP-15-notebook-PC-series/7771404/model/8326082

    Your machine needs a driver Intel graphics high definition (HD).

    You must install the Driver and Intel Chipset Installation Utility and driver Intel Management Engine Interface (MEI) and restart the machine first.

    After all this, you need the following driver to use the keyboard shortcut:

    http://h20564.www2.HP.com/hpsc/SWD/public/detail?swItemId=ob_129672_1

    Kind regards.

  • BI Publisher 11: decrease the resistance of the graph in the designer

    Hello

    We use Oracle BI Publisher 11.1.1.7.150120 (build # 20150113.1211 kill him Jan 13 12:15:48 THIS 2015)

    can you tell me please how to decrease the hardness of the graph in the designer of BI, I enclose a sample Charter.

    Best regards

    Djam

    Episseur_trait.JPG

    I create an SR, and the solution is:

    This is done via the property table:

    With the layout template open in edit mode, expand the 'Properties' of the left frame section.

    -Select the first 4 charts

    -then Properties section expand the "graphic plot area.

    -Select 'Series 1 line width' and enter the value 1 px

    -Select 'Series 2 line width' and enter the value 1 px

    -Select 'Series 3 line width' and enter the value 1 px

    Djam

  • Alt key decreases the brightness of the screen how to turn it off?

    Hi all

    I own a Lenovo T440S, it works on windows 8. So today, I accidentally spilled tea on the keyboard, but it seems to work very well. He should at least given that this laptop is designed to support it.

    Everything seems to work very well, but my left alt key now decreases the brightness of the screen every time I click on it.

    Can someone tell me how I can stop this? It's so embarrassing to have the brightness down whenever I use it.

    Hi Bianca,.

    Thanks for posting your query in Microsoft Community.

    According to the description of your problem, if this behavior has started to occur after you had spilled tea on the keyboard, then it might be a hardware problem with the specific key. The brightness options are provided with the "fn" in Lenovo thinkpad.

    I suggest you begin the diagnostic system in the Web site of the manufacturer for this model only. and check if it helps.

    ThinkPad T440S Support

    If the problem persists, then I suggest you to contact Lenovo's Thinkpad technical support for assistance.

    Lenovo: Contact us

    Hope this information is useful. Please do not hesitate to post where you get problems with Windows in the future, we will be happy to help you.

Maybe you are looking for