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

Mixin for animation-timing-function and transition-timing-function #3

Open
meduzen opened this issue Jan 2, 2020 · 0 comments
Open
Labels
question Further information is requested

Comments

@meduzen
Copy link
Owner

meduzen commented Jan 2, 2020

It could be less cumbersome to write the CSS transition-timing-function and animation-timing-function rules. A mixin could be handy, but it has to be straightforward and intuitive.

So, in order to generate one of these lines of CSS:

.my-class {
  transition-timing-function: cubic-bezier(0.455, 0.03, 0.515, 0.955); /* = in-out-quad */
  transition-timing-function: var(--in-out-quad);
}

This SCSS could be written:

.my-class {
  // using current easings.scss version
  transition-timing-function: $in-out-quad;
  transition-timing-function: bezier(.455, .03, .515, .955);

  // straightforward,but is it for animation-timing-function or transtition-timing-function?
  @include timing('in-out-quad');
  @include timing(.455, .03, .515, .955);

  // a bit longer, but still shorter and more explicit than previous proposal
  @include transition-timing('in-out-quad');
  @include transition-timing(.455, .03, .515, .955);

  // alternative, but less explicit about what it generates
  @include transition-easing('in-out-quad');
  @include transition-easing(.455, .03, .515, .955);
}

It looks that for the easings already included in easings.scss, there’s no benefit. But for custom easing curves, it’s a 8 characters saving.

Waiting for feedbacks (and mine after using the library in real projects during a few months).

@meduzen meduzen added the question Further information is requested label Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant