[E] Add optional easing to smooth scrolling

Post about what you like and dislike on AAO and suggest new features and improvements.

Moderator: EN - Forum Moderators

Post Reply
User avatar
ThePaSch
Moderator
Posts: 1269
Joined: Sun Jun 13, 2010 5:56 pm
Gender: Male
Spoken languages: English, German (native)
Location: Germany

[E] Add optional easing to smooth scrolling

Post by ThePaSch »

Smooth scrolling is currently a linear transition curve, which is applicable to the AAI games and multi-sided investigation locations in the original games; however, in the original games, courtroom scrolling had a rather steep easing curve with high acceleration and deceleration. How technically involved would it be to allow the user to set their own easing values OR alternatively provide a dropdown for applying predetermined easing values to the scroll?
Last edited by ThePaSch on Mon Sep 05, 2016 12:15 am, edited 2 times in total.
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: [E] Add optional easing to smooth scrolling

Post by Enthalpy »

There are two separate questions here: how hard it would be to do such a thing in general, and how hard it would be to incorporate that into the infrastructure that AAO has now.

Right now, AAO uses this image. It sets the position in the viewport and then uses the transition css keyword to move from left to right. The fact that we use the transition css keyword limits us to certain kinds of ways to move the image around. What you want can be accomplished through something called a Bézier curve. While this can certainly be done, Bézier curves are hard enough to work with that I think it would be better to select from a preset. So the answer to the first question: fairly straightforward.

Adding this to AAO is trickier. Currently, if you ask each frame what its transition is, it would tell you "true" or "false". Under this proposal, it isn't that simple! A frame could tell you, "false," "linear" (like it is now), "Bézier curve" (like it would have to be for your proposal), or maybe other options! We would need to rethink what kinds of transitions AAO will allow and how a frame will store those. Not an easy thing!

Unas is in the middle of writing an architecture change to AAO, which will allow us to add new fields to frames and similar AAO objects. I'll look at this more closely when he's finished his change, as the new architecture will determine how easily this new change can happen. If you want the technical details on this architecture change and have some background knowledge of JavaScript, see here.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
User avatar
ThePaSch
Moderator
Posts: 1269
Joined: Sun Jun 13, 2010 5:56 pm
Gender: Male
Spoken languages: English, German (native)
Location: Germany

Re: [E] Add optional easing to smooth scrolling

Post by ThePaSch »

I understand; thanks for the quick response! I was aware that doing this in general wouldn't be a complicated matter, but was more curious whether the current model that AAO is based on would (easily) support such a change. The switch to a new architecture certainly sounds exciting. I do know Javascript, so I was curious as to what this change would look like, but the repo you linked to seems to be locked/private. Is it supposed to be?
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: [E] Add optional easing to smooth scrolling

Post by Enthalpy »

I can view it, and I'm not aware of any restrictions on it. Are you logged in with a BitBucket account?

Now that I'm looking over the code again, I realize that I made a major mistake: the place_transition field of frame objects is not stored as true or false, but as 0 or 1 - integers. That allows us to add a 2, which is exactly what you'd need for this feature. We don't have to worry about the architecture change at all!

The first step would be to add new place_transition values by amending trialdata_constants.php. You'll have to change the screen editor so that smooth scrolling options are no longer a checkbox but a simple select, change the functions that assume that the only place_transition values are 1, and then add a new transitioning type in top_screen_engine.css that has a Bézier curve to your liking.

If you're interested in developing this feature, then feel free to start developing it! Now that AAO is open-source, you can find the developmental version of AAO here, and feel free to make sure of the developer's forum.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
User avatar
ThePaSch
Moderator
Posts: 1269
Joined: Sun Jun 13, 2010 5:56 pm
Gender: Male
Spoken languages: English, German (native)
Location: Germany

Re: [E] Add optional easing to smooth scrolling

Post by ThePaSch »

Enthalpy wrote:I can view it, and I'm not aware of any restrictions on it. Are you logged in with a BitBucket account?
I am, but it's telling me my access is denied. Could it have something to do with the fact that it's a branch of the repo on the UnasZole account instead of the public AAO repo on the AceAttorneyOnline team?

As for your realization - that's pretty great news! Thanks for the quick explanation on where to find everything relevant. I'll certainly see if I can make it work on my own. Cheers!
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: [E] Add optional easing to smooth scrolling

Post by Enthalpy »

That could be it. I have read permissions there, but you may not. I think your best bet is to write a message in the AAO Developer's forum asking to be given permissions.

Good luck!
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
User avatar
ThePaSch
Moderator
Posts: 1269
Joined: Sun Jun 13, 2010 5:56 pm
Gender: Male
Spoken languages: English, German (native)
Location: Germany

Re: [E] Add optional easing to smooth scrolling

Post by ThePaSch »

You were right - implementing this wasn't a big hassle at all (though navigating through the codebase and figuring out what triggers what with which parameters at what place in order to find out where to change things was a bit tedious, lol). After making sure everything works, I've now created a pull request with a working version of the feature. Hoping it can get approved quickly. :p

Thanks for your pointers!
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: [E] Add optional easing to smooth scrolling

Post by Enthalpy »

ThePaSch wrote:(though navigating through the codebase and figuring out what triggers what with which parameters at what place in order to find out where to change things was a bit tedious, lol)
grep is love. grep is life.

In all seriousness, nice! It may be a while before Unas accepts it and even longer before it goes live. I wish I had a firm time for you on any of those, but those depend on Unas. In any event, I'll read it tomorrow to see how it looks.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
User avatar
ThePaSch
Moderator
Posts: 1269
Joined: Sun Jun 13, 2010 5:56 pm
Gender: Male
Spoken languages: English, German (native)
Location: Germany

Re: [E] Add optional easing to smooth scrolling

Post by ThePaSch »

Enthalpy wrote: grep is love. grep is life.
Eh, N++'s directory search worked just fine. It was certainly a godsend. :mrgreen:
Post Reply