Anim8: Vote your preferred flip method syntax

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.

What flipping animation syntax do you fancy?

a1
0
No votes
a2
4
27%
a3
3
20%
a4
8
53%
other (please comment)
0
No votes
 
Total votes: 15

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Anim8: Vote your preferred flip method syntax

Post by Robin »

kikito wrote:Ah, but your commend provided some useful info. Some people voted for one option, but declared that they really didn't feel too strongly about it. You, on the other hand, chose a4 'without a doubt'. That is significant. May I ask why?
First, I'd prefer a3/a4 over a1/a2, because they have less boilerplate: a1/a2 take more time typing (more about the additional chance of typos than about time, really), without adding semantic clarification: secondAnimation = anim8.flipH(firstAnimation) says "the second animation is an animation that is the first animation flipped horizontally", where secondAnimation = firstAnimation:flipH() says "the second animation is the first animation flipped horizontally". It says the same thing with fewer words.
Second, I'd prefer a1/a4 over a2/a3, because the choice between horizontal and vertical is "static" rather than "dynamic": if you flip horizontally it would usually not make sense to flip vertically instead and vice versa. I'd say: only make something an argument if it makes sense to pass it as a variable, and I think you would only pass constants as the axis argument in practice.

As a crazy example, you could also do:

Code: Select all

local a = anim8('new', ...)
local a1 = anim8('flip', 'h', a)
but you don't, for the same reason.

(This has gotten a bit more ranty than I intended. Back to the thread!)
Help us help you: attach a .love.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Anim8: Vote your preferred flip method syntax

Post by kikito »

Garan wrote:If you just have a flip like that, you might end up flipping twice when only once was needed. I was also wondering if there could be an optional parameter in anim8:draw that says which direction to draw. That way I can keep using my direction variables.
Anim8 has to be flexible enough to be used in any case. Coupling it with a "direction" concept would limit it (for example, someone may want to animate a character doing a moonwalk, or walking against a strong wind). I can provide easy ways to create animations, but how they relate with each direction is game-specific.
Robin wrote:I'd prefer a3/a4 over a1/a2, because they have less boilerplate: a1/a2 take more time typing
Agreed. But some people might think that flipping modifies the animation, instead of creating a new one.
Robin wrote:Second, I'd prefer a1/a4 over a2/a3, because the choice between horizontal and vertical is "static" rather than "dynamic": if you flip horizontally it would usually not make sense to flip vertically instead and vice versa.
You might want to flip something both vertically and horizontally. If you only have flipH and flipV you will need to create an intermediate animation to do that (or have a dedicated method called flipHV). But I think that this is not very frequent.


EDIT: After further consideration, I've decided to use flipH and flipV as "toggle" methods. This is due mainly to the fact that anim8 already has a dedicated method for cloning an animation, called "clone". I had just forgotten about it. Implementing the flip methods as "togglers" was much more convenient once I realized that clone was there. I've updated the anim8 post with the details.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests