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

Add Transform and Grid based animations #10

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

Conversation

smspillaz
Copy link
Contributor

@smspillaz smspillaz commented Jul 9, 2019

This branch adds some affine transformation animations, grid transformation animations and associated helpers. (Note: This work was started about a year ago while I was still at Endless, but was never actually finished and I didn't get much of a chance to work on it due to my study commitments, but I've finally had the time to refactor things into what is a hopefully better state now. I said I would eventually get around to this, so here it is :-)).

Stepping the animations is done using Stepper implementations (just a function object at the moment, an interface in the GObject interface). They can be composed as functions of each other, for instance the Reverse stepper is a composition of 1.0f - baseStepper(ms).

All the transform animations themselves are implementations of the TransformAnimation interface - the TransformAnimation class does not have any concrete implementation details. The animations themselves share code through the added header files with utility methods.

The actual matrix math is implemented using glm, a popular C++ header only library used for doing matrix transformations.

The GridAnimation template and helper functions, can be used to animate surfaces by deforming equally spaced vertices on a texture.

Changed from #4 and #8 is that the C++ animations now no longer require all properties to be specified in order to be constructed. Instead, they each have a default constructor, which sets sane defaults for the parameters of the animation. I also added a "property" system which allows callers to get/set properties on the animation in an ABI-safe way without too much boilerplate. This change (combined with a few other things), allows us to then drop a bunch of constructor abuse from the GObject wrappers - we now just construct the animation using the default constructor and let the property system handle the rest (though there are a few exceptions for object-valued properties, which comes from the fact that it doesn't make sense to allow those properties to be NULL and the defaults set on the C++ side are not bindings-friendly implementations).

Also changed from #4 and #8:

  • The steppers are no longer C++ closures. This didn't work too well with bindings. Instead they are objects, with virtual methods (eg, the ReverseStepper takes a Stepper subclass as its argument, where we can pass a glib::StepperWrapper in order to wrap the GObject stepper implementation directly, as opposed to having to create all these intermediary GObjects every time a property is accessed.
  • Introduced animation::BoxQuery - which is explained a little more in the relevant commit, but it is essentially a mechanism to keep track of changes to surface geometry during the animation.
  • Added tests on the GJS side to make sure that the bindings work correctly
  • Moved the clutter integration into libanimation itself (meaning that less code needs to be carried in the shell)
  • Created a gnome-shell extension so this can be tested directly.

https://phabricator.endlessm.com/T23543
https://phabricator.endlessm.com/T23697

smspillaz and others added 6 commits July 9, 2019 15:50
If we know that two points are going to be of the same type,
it is convenient to be able to compare them with the == operator
as opposed to having to use agd::equals
The "box" type represents a simple perpendicular quadrilateral
in 2D space given by its top left and bottom right co-ordinates
(eg, x1, y1, x2, y2).
@eos-shell-build
Copy link

I don't recognize the submitter as a member of @endlessm. Can somebody in @endlessm verify the patch? See https://phabricator.endlessm.com/w/software/build/ci-integration/#pull-requests for more details.

smspillaz and others added 3 commits July 9, 2019 23:38
When animating from one position to another, it is possible that
some things could change underneath us. For instance, the target position
of the surface may be changed by the user while the animation is in progress.

In this case, the animation needs to adapt to this change by allowing
the caller some mechanism to transparently change the target box
tha the surface is animating to. This can be done by overriding
the animation::BoxQuery class and calling the Update() method as
appropriate, which will update the saved geometry of the target position.

For example, in a windowing system, one might set up a listener
for surface geometry events in their animation::BoxQuery subclass,
which then calls Update() when the geometry has been changed. This
obviates the need for the caller to explicitly update all animations.
This is necessary in order to use it with some of the testing
operators (like agd::Equals or agd::AlmostEq), since those
testing operators use operator<< in order to print out the
contents of the type in the event of a matching failure.
We're going to do affine transformations and glm is a particularly
well respected library for things like that. Note that the dependency
is a submodule, so you'll need to fetch and pull submodules before
building.
@smspillaz smspillaz force-pushed the wip/smspillaz/refactor branch 4 times, most recently from ba877b6 to 513233d Compare July 9, 2019 21:29
@smspillaz smspillaz changed the title Wip/smspillaz/refactor Add Transform and Grid based animations Jul 9, 2019
@smspillaz
Copy link
Contributor Author

Note: Travis is failing. I had a look into it, its some complications that come with trying to get the build dependencies in the docker container. I'm sure its fixable, may just time some more iterations...

@smspillaz smspillaz closed this Jul 10, 2019
@smspillaz smspillaz reopened this Jul 10, 2019
@smspillaz smspillaz force-pushed the wip/smspillaz/refactor branch 8 times, most recently from b346964 to 5359d28 Compare July 10, 2019 10:29
These include matrixMultiplyVector (multiplying a 4D matrix with a
4D vector), BoxWrapper (wraps a Animation.Box in an Animation.BoxQuery),
and applyCallerTranslation
Steppers encapsulate some progress change within the animation. The
typical case is linear stepping, which just interpolates from
0 to 1. However, another case is reverse stepping which is
composed by 1.0f - linear (ms).

Future steppers can be added to add all sorts of easing parameters.

https://phabricator.endlessm.com/T23543
This uses AnimationClutter to provide animations for GNOME-Shell. It
listens for certain windows events, then runs animations according
to the settings in the org.gnome.shell.extensions.animation schema.
We need this for libmutter-4-dev
Seems like newer ubuntu images complain about the way that meson sets
these up and linking with asan seems to hang, so we need to disable it for now.
We now have additional JS tests that we would like to run
@smspillaz smspillaz force-pushed the wip/smspillaz/refactor branch 2 times, most recently from 315c848 to f7f9353 Compare July 10, 2019 11:10
The built package on OBS is out of date and not compatible with
mozjs60
@smspillaz
Copy link
Contributor Author

Okay, travis is passing now.

@smspillaz smspillaz marked this pull request as ready for review July 21, 2019 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants