ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Trigger animation start when certain values are achieved

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Darko Bosic
Trigger animation start when certain values are achieved
on Feb 10, 2020 at 5:32:55 pm

Hi, Darko here,
I'm having some problems with my expression.

Let's say I want to trigger opacity of one object A going from 0 to 100 when another object B reaches position of x = 500 and y = 500 or grater.
I've made trigger and it works fine, but I can't wrap my head around how to make it animated and not just instant.
Right now when object B reaches x = 500 and y = 500 opacity just jumps from 0 to 100.

Here is my expression so far:

o = transform.opacity;
objBx = thisComp.layer("Object B").transform.position[0];
objBy = thisComp.layer("Object B").transform.position[1];

if (objBx > 500 && objBy > 500){
o = 100;
}
else{
o = 0;
}

I want to make this without any keyframes, and I think that's where things get complicated. I've tried using linear and ease expressions but I think don't understand them really good and can't get them to work.

Thanks for your time and help!

Darko Bosic


Return to posts index

Robin de Man
Re: Trigger animation start when certain values are achieved
on Feb 12, 2020 at 10:33:03 am

Is it an option to use the linear function?

var o = transform.opacity;
var objBx = thisComp.layer("Object B").transform.position[0];
var objBy = thisComp.layer("Object B").transform.position[1];
var objPos = objBx + objBy;

o = linear(objPos, 0,1000, 0, 100);


Return to posts index

Darko Bosic
Re: Trigger animation start when certain values are achieved
on Feb 12, 2020 at 1:12:09 pm

If I'm understanding your code correctly, you are getting one value from two dimensional values and that doesn't work for me. Also in linear(objPos, 0,1000, 0, 100) second and third arguments gave me some really strange results. I think the problem is that my arguments in if statement are spacial and so are arguments in linear.
I'll keep on trying different stuff until I get it!

Thanks for the help!

Darko Bosic


Return to posts index


Robin de Man
Re: Trigger animation start when certain values are achieved
on Feb 12, 2020 at 1:25:24 pm
Last Edited By Robin de Man on Feb 12, 2020 at 1:28:55 pm

I made a small setup with the linear function in, maybe it helps.
https://www.dropbox.com/s/y6cy1kveamifw1g/transparant-position.zip?dl=0

its a AE cc 2018 file

gr Robin


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]