【问题标题】:After Effects: How to change a property of an object based on the color or a pixel?After Effects:如何根据颜色或像素更改对象的属性?
【发布时间】:2022-08-10 03:45:30
【问题描述】:

在 Adob​​e After Effects 中,如何根据(另一个对象的)特定位置的像素颜色更改对象的属性(例如不透明度)。

该应用程序是,如果另一层中的特定像素变成特定颜色,我想覆盖/揭示一部分(通过更改图层不透明度)。

    标签: after-effects


    【解决方案1】:

    您可以使用 sampleImage() 函数来获取特定的像素颜色。

    这个表达式相当慢,所以只要知道它会影响渲染时间。此链接将很有用:https://www.motionscript.com/design-guide/sample-image.html

    例如,下面的表达式将根据屏幕中间像素的亮度值改变不透明度:

    var target = thisComp.layer("video");
    // sampleImage() returns an array with R,G,B,Alpha values
    var color = target.sampleImage(transform.position, [width, height]/2, true, time)
    // get the luma by averaging the 3 channel values (there are more scientific ways to do this, but this is quick and simple)
    var luma = (color[0] + color[1] + color[2]) / 3
    // divide the luma by 255 if you work in 8bits project
    var luma_value = luma / 255;
    // use the 0-1 value as an opacity percentage.
    luma_value * 100;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-26
      • 2021-05-31
      • 2022-01-13
      • 2012-12-07
      • 2019-03-09
      • 2019-10-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多