Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewCommand 2052 - AnimateVariable #3132

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jetrotal
Copy link
Contributor

@jetrotal jetrotal commented Oct 25, 2023

Video Demo
image

The idea is to generate and execute a sequence of variables command changes that goes from
a start value to an end value. Following Motion Easing, Time Duration and a pause between frames.

@raw 2052, "linear/bounceOut", 0, 1, 0, 0, 0, 240, 0, 640, 0, 0 
@raw 2052, "easeTypeStart/easeTypeEnd", targetVariableIsVar, targetVariable, startIsVar, start, endIsVar, end, durationIsVar, duration, pauseIsVar, pause

You can also write only bounceInOut instead of bounceIn/bounceOut
easeTypeStart and easeTypeEnd can be:

"linear"
"ease", "easeIn", "easeOut", "easeInOut"

"quadIn", "quadOut", "quadInOut" //quadratic easing
"cubicIn", "cubicOut", "cubicInOut"
"quartIn", "quartOut", "quartInOut"
"quintIn", "quintOut", "quintInOut"

"sineIn", "sineOut", "sineInOut" //sinusoidal easing
"ExpoIn", "expoOut", "expoInOut"  //exponential easing
"circIn", "circOut", "circInOut"  //circular easing
"backIn", "backOut", "backInOut"

"elasticIn", "elasticOut", "elasticInOut"
"bounceIn", "bounceOut", "bounceInOut"

bezier(x1, y1, x2, y2) //cubic Bezier(curveHandle1_x, curveHandle1_y, curveHandle2_x, curveHandle2_y,)

cubic bezier works!!!!!!!!!!
References for getting bezier values:
https://matthewlein.com/tools/ceaser
https://cubic-bezier.com/

image
bezier(0.9, -0.3, 0.03, 1.3) - Black dots position representx x1, y1 and x2, y2.

@Ghabry Ghabry marked this pull request as draft November 2, 2023 15:18
@fdelapena fdelapena added the Awaiting Rebase Pull requests with conflicting files due to former merge label Nov 20, 2023
@jetrotal
Copy link
Contributor Author

jetrotal commented Nov 25, 2023

I learned what I needed to know about setting up cubic bezier, clean interpolation and correct event event pushing.
Everything is fully functional and a little cleaner to read.

@jetrotal jetrotal marked this pull request as ready for review November 28, 2023 10:50
@jetrotal
Copy link
Contributor Author

This one is properly rebased and fully working.

@raw 2052, "linear/bounceOut", 0, 1, 0, 0, 0, 240, 0, 640, 0, 0
` CommandInterpolateVariable("easeTypeStart/easeTypeEnd",[targetIsVar, target, StartIsVar, start, endIsVar, end, durationIsVar, duration, pauseIsVar, pause]) `

cubic bezier is broken. There are some libraries about it, I'll see what to do.

I'll need help with this one. It's almost fully working.
@Ghabry
Copy link
Member

Ghabry commented May 10, 2024

any idea in which file that cubicBezir function could be relocated? Is 150 lines so do not really want that much extra lines in this already far-too-complex cpp file 😅 .

Oh, and a camel walked through your code ;).

// this is a fix, again, with post-increment operators <- Can you explain why this is needed?

@jetrotal
Copy link
Contributor Author

Cubic bezier stuff could be realocated to a new file, maybe called: animation_helper. Since this could be ported for pictures, or whatever moves between points if needed.

Those comments I wrote while fighting some annoying bugs that I can't remember anymore xD
I should delete them.

@jetrotal
Copy link
Contributor Author

Changed the code, feel free to rename the newer files if "animation_helper" is not a good name convention.

btw, there's a minor issue that I wasn't able to fix but it's not a problem if this isn't fixed at all:

image

I failed to make the the InOut interpolation work exactly as the In/Out interpolation

The picture A above use linear/linear, then ElasticIn/ElasticOut
The picture B above use linear, then ElasticInOut

The issue may be related to the // use 2 interpolations: start and end. area of the code.

Here's the map with this demo: Talk to the Dog to start it:
Map0007.zip

@jetrotal jetrotal force-pushed the NewCommand-AnimateVariable branch from e4369cb to 541864f Compare May 12, 2024 16:03
- Moved 2 longer functions to a file called animation_helper.
- Snake_Case and removal of useless comments.

Update Makefile.am
@jetrotal jetrotal force-pushed the NewCommand-AnimateVariable branch from 541864f to be57749 Compare May 12, 2024 16:04
@Ghabry Ghabry removed the Awaiting Rebase Pull requests with conflicting files due to former merge label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants