NewCommand 2052 - AnimateVariable#3132
Conversation
e788dfc to
c4f589b
Compare
|
I learned what I needed to know about setting up cubic bezier, clean interpolation and correct event event pushing. |
481cb6b to
0f98189
Compare
0f98189 to
4479a7e
Compare
|
This one is properly rebased and fully working. |
4479a7e to
4c7930c
Compare
4c7930c to
77093e7
Compare
77093e7 to
1428fdb
Compare
|
any idea in which file that Oh, and a camel walked through your code ;).
|
|
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 |
|
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: I failed to make the the The picture A above use The issue may be related to the Here's the map with this demo: Talk to the Dog to start it: |
541864f to
be57749
Compare
1fbdeea to
8aed735
Compare
|
Rebased. |
8aed735 to
7bd16bb
Compare
|
about double Animation_Helper::CubicBezier(float t, const double& p0, const double& p1, const double& p2, const double& p3) {
float u = 1 - t;
float tt = t * t;
float uu = u * u;
float uuu = uu * u;
float ttt = tt * t;
//Point2d p = {0,0};
//p.x = uuu * 0 + 3 * uu * t * p0 + 3 * u * tt * p2 + ttt * 1;
return uuu * 0 + 3 * uu * t * p1 + 3 * u * tt * p3 + ttt * 1;
//return p.y;
}How is this supposed to work? The first expression According to Wikipedia the formula is: so shouldn't it be: uuu * p0 + 3 * uu * t * p1 + 3 * u * tt * p2 + ttt * p3? |
|
I kinda remember now what's going on What I wanted to get was the specific value of the animation at current time (A single point inside the blue line above). I remember having to hard code some stuff, because the original algorithm was retrieving something else. |
@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.
Update game_interpreter.cpp
- Moved 2 longer functions to a file called animation_helper. - Snake_Case and removal of useless comments. Update Makefile.am
7bd16bb to
f39448d
Compare
|
the bezier algorithm now considers "timming modifiers" and it's better presented overall @Ghabry take a look, this may be cleaner for 0.8.1 |



Video Demo

The idea is to generate and execute a sequence of variables command changes that goes from
a
startvalue to anendvalue. Following Motion Easing, Time Duration and a pause between frames.You can also write only
bounceInOutinstead ofbounceIn/bounceOuteaseTypeStartandeaseTypeEndcan be:cubic bezier works!!!!!!!!!!
References for getting bezier values:
https://matthewlein.com/tools/ceaser
https://cubic-bezier.com/
bezier(0.9, -0.3, 0.03, 1.3)- Black dots position representxx1, y1andx2, y2.