first time user trying to figure out this error

New Here ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

I'm following a yt tutorial that's not for mac on a mac and I keep getting this simple error

 

error : error : argument 1 to sampleImage() must be 2 numbers

 

this is my expression:

 

p = thisComp.layer("NULL").transform.position[0]
s = thisLayer
a = s.sampleImage(p, [.1,.1])[3]
linear(a,0,1,0,100)

 

I'm trying to get the opacity of an image to go from 0 to 100 when the mouse hovers

Any help will be greatly appreciated so that I can learn with you guys!

TOPICS
Error or problem , Expressions , How to , Scripting

Views

37

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

Hi,

i'm not sure but it seems you need the x and y coordinates for sampleimage to work.

Try removing the [0] (points to the x-coordinate). Maybe it helps.

p = thisComp.layer("NULL").transform.position;

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

LATEST

Akira, you are the best!! I can't believe it was that simple jajaja.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines