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

Gradient - clarification needed #105

Open
mgrudzinska opened this issue Oct 15, 2024 · 3 comments · Fixed by #111
Open

Gradient - clarification needed #105

mgrudzinska opened this issue Oct 15, 2024 · 3 comments · Fixed by #111
Milestone

Comments

@mgrudzinska
Copy link
Contributor

From the specs:

first paragraph:
...tuples, where position is similar to color stops' position.
Similar should be specified. Should it be the same value for colors and for transparency? (I know it does not, because it is written later in the specs).

third paragraph:
The color stop count is typically specified in a separate field from the gradient values
Typically ? it may not be specified?
since Transparency stops may or may not match the count and offset of color stops. then how to interpret 8 values?
1 color stop and 2 alphas: off r g b off a off a
or
2 color stops:off r g b off r g b

@mbasaglia
Copy link
Member

Offsets for alpha stops don't need to have the same values as the ones for color stops.

The stop count is always defined, otherwise you can't tell if you are using transparency or not.

@theashraf
Copy link

@mbasaglia What is the current status of the Gradient slot specifications ?

Is this example aligned with the Lottie specifications?

Here’s the slot data to override:

{
    "gradient_fill": {
        "p": {
            "p": 2,      // Number of color stops: 2
            "k": {
                "k": [
                    0,
                    0.1,
                    0.1,
                    0.2,
                    1,
                    1,
                    0.1,
                    0.2,
                    0,
                    0,
                    1,
                    1
                ]
            }
        }
    }
}

Here’s the target gradient property:

"g": {
    "p": 9,   // Number of color stops: 9
    "k": {
        "a": 0,
        "k": [
            0,
            0.514,
            0.373,
            0.984,
            0.141,
            0.478,
            0.412,
            0.984,
            0.283,
            0.443,
            0.451,
            0.984,
            0.379,
            0.408,
            0.49,
            0.984,
            0.475,
            0.373,
            0.529,
            0.984,
            0.606,
            0.278,
            0.647,
            0.925,
            0.737,
            0.184,
            0.765,
            0.867,
            0.868,
            0.092,
            0.882,
            0.808,
            1,
            0,
            1,
            0.749
        ]
    },
    "sid": "gradient_fill"
}

@b-wils b-wils added this to the 1.0.1 milestone Nov 12, 2024
@b-wils
Copy link
Contributor

b-wils commented Nov 12, 2024

@theashraf gradient slots are not in the 1.0 specification. It is something we plan to add in the future. Possibly 1.1.

That being said, your example is consistent with how other slottable properties behave and some players may already support it.

@b-wils b-wils linked a pull request Nov 15, 2024 that will close this issue
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 a pull request may close this issue.

4 participants