Skip to content

FlexEGs behaving incorrectly for shape values between -1 and 0 / 0 and +1 #1176

@Lyve1981

Description

@Lyve1981

According to the specification, a shape value of 0 should be linear, values < 0 should be faster, values > 0 slower. However, this does not apply for values that are between -1 and +1 (and not 0):

I looked up the code and found the formula, which is:

For positive shape values:
std::pow(x, shape);

For negative shape values:
1 - std::pow(1 - x, -shape)

Note that, in both cases above, a shape value of 1 results in a linear curve, even though this should happen for a value of 0 (which it does because for the value 0, a default curve is returned).

However, this causes the curve to be the opposite of what you want if the value is -1 < shape < 0 or 0 < shape < 1

For a shape value of -6, its looking good:
image

But notice what happens for a shape value of -1:
image

A very extreme case, a shape value of -0.1, this should be very close to being linear, but it isn't:
image

The correct formula should be:

For positive shape values:
std::pow(x, shape + 1);

For negative shape values:
1 - std::pow(1 - x, -shape + 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions