michalsnik / aos

Animate on scroll library
MIT License
26.78k stars 2.59k forks source link

Library does not read calculated values #579

Open Youssef93 opened 4 years ago

Youssef93 commented 4 years ago

This is:

Specifications

Expected Behavior

I'd expect when adding a calculated value for an animation duration or animation delay, it would work. For example data-aos-delay="2*500" this should work. This is useful because in my case I am using angular with a for loop and I want each element to be delayed based on its index in the array. data-aos-delay="i*100"

Actual Behavior

I believe in this case the library just goes with the defaulted value.

Possible Solution

I suggest finding a way to make these fields take a dynamically calculated number

AlbertSmit commented 4 years ago

Just to be sure; are you sure that data-aos-delay="2*500" would not resolve to be a string in your scenario?

Youssef93 commented 4 years ago

Yes. I have also tried this data-aos-delay="parseInt(2*500)" but did not work either

rajivkr commented 4 years ago

I tried [attr.data-aos-delay]="i * 200", seems to be working fine for me.