【发布时间】:2022-08-10 03:45:30
【问题描述】:
在 Adobe After Effects 中,如何根据(另一个对象的)特定位置的像素颜色更改对象的属性(例如不透明度)。
该应用程序是,如果另一层中的特定像素变成特定颜色,我想覆盖/揭示一部分(通过更改图层不透明度)。
标签: after-effects
在 Adobe After Effects 中,如何根据(另一个对象的)特定位置的像素颜色更改对象的属性(例如不透明度)。
该应用程序是,如果另一层中的特定像素变成特定颜色,我想覆盖/揭示一部分(通过更改图层不透明度)。
标签: after-effects
您可以使用 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;
【讨论】: