MyNixOS website logo
Description

Defining and manipulating css easing strings.

A package to define css easing strings. These can be used in Julius, JSON, etc. templates to limit the easings to valid ones.

css-easings

Build Status of the package by GitHub actions Build Status of the package by Hackage Hackage version badge

A package that can be used to render CSS easing functions. One can use the Easing type to specify how the "speed" of a certain animation should be handled in time.

This package can be used in other items, such as objects that are then converted to JSON to make it more safe, since it narrows the amount of possible css strings to valid CSS easing functions.

The package documentation can be found on the GitHub pages.

Easing structure

There are two types of CSS easings:

  1. A steps(n, jump-term) with n the number of steps, and jump-term the type of jump; and
  2. A quadratic-bezier(x1, y1, x2, y2) that works with a quaratic Bezier curve. Here both x1 and x2 need to between 0 and 1.

The type that we use for easings in this package is Easing.

There are four types of jumps: jump-start, jump-end, jump-none, and jump-both. start and end are aliasses for jump-start and jump-end respectively. The type we use in this package for these is JumpTerm.

Besides that, CSS has some aliasses for common easing types like steps-start, steps-end, ease, linear, ease-in, ease-out, and ease-in-out.

PostCSS defines extra aliases like:

  1. easeInSine, easeOutSine, and easeInOutSine;
  2. easeInQuad, easeOutQuad, and easeInOutQuad;
  3. easeInCubic, easeOutCubic, and easeInOutCubic;
  4. easeInQuant, easeOutQuant, and easeInOutQuant;
  5. easeInQuint, easeOutQuint, and easeInOutQuint;
  6. easeInExpo, easeOutExpo, and easeInOutExpo;
  7. easeInCirc, easeOutCirc, and easeInOutCirc; and
  8. easeInBack, easeOutBack, and easeInOutBack.

These are also included as patterns in this project. When these are rendered, for example as a JSON string, it will use the CSS equivalent.

ToMarkup, ToJSON, and ToJavascript instances

Both the JumpTerm and Easing type are members of the ToMarkup, ToJSON and ToJavascript type classes to convert the easings to their text equivalent.

For the ToMarkup, the CSS counterparts are just written to the markup stream, and thus not wrapped in a string literal. Since the possible easings do not contain any characters that need to be escaped, there is no problem with escaping.

For both ToJavascript and ToJSON instances, the values are wrapped in a JSON string, since in many Javascript libraries, one uses strings to update easings.

Arbitrary css easings

One can generate arbitrary Easings and JumpTerms. It is however not advisable to use this for anything other than for validation purposes (like with QuickCheck).

css-easings is not safe Haskell

There are not extensions that are used that make the library itself unsafe, but it makes use of aeson, blaze-markup, etc. and the packages are not safe. Hence this package is not safe Haskell.

Contribute

You can contribute by making a pull request on the GitHub repository.

You can contact the package maintainer by sending a mail to [email protected].


This package is dedicated to Nordin Allaert (2001-2020), the son of a colleague. His life went in an ease-in manner, but was taken too soon.

Metadata

Version

0.2.3.0

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows