Created
February 1, 2021 13:22
-
-
Save GoodBoyNinja/84ecbc838256b905c7ed7f9aeb809685 to your computer and use it in GitHub Desktop.
When applied to a text layer source text, it will show "+ / - " according to whether the point the expression is looking at is speeding up or slowing down.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AccelDeccel(point) { | |
xResult = ""; | |
yResult = ""; | |
pointVelocity = point.velocity; | |
pointVelocityLastFrame = point.velocityAtTime(time - thisComp.frameDuration); | |
xVelocityNow = Math.abs(pointVelocity[0]); | |
yVelocityNow = Math.abs(pointVelocity[1]); | |
xVelocityLastFrame = Math.abs(pointVelocityLastFrame[0]); | |
yVelocityLastFrame = Math.abs(pointVelocityLastFrame[1]); | |
xResult = (xVelocityNow > xVelocityLastFrame && xVelocityNow) ? "+" : (xVelocityNow < xVelocityLastFrame && xVelocityNow) ? "-" : ""; | |
yResult = (yVelocityNow > yVelocityLastFrame && yVelocityNow) ? "+" : (yVelocityNow < yVelocityLastFrame && yVelocityNow) ? "-" : ""; | |
return [ xResult, yResult ]; | |
} | |
AccelDeccel(/*pickqhip a point here, like a layer's poition property*/); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment