Skip to main content

Robert Penner's easings functions in python

Project description

Robert Penner's Easing Functions

SYNOPSIS

`rpeasings.EASING_FUNCTION(t: float) -> float

returns t (between 0 and 1) eased by the chosen function.

DESCRIPTION

There are a plethora of versions available of these, many of which provide an object oriented interface, while most of the original easing functions could be simple inline expressions.

This library takes the purely functional approach. No class instantiation, just a function call.

See https://easings.net for a good visualisation of these to chose the right one.

Alternatively, if you have pygame-ce installed, you can launch the rpeasings-catalog.py script in the catalog folder. This will not work on the outdated "official" pygame release.

Module contents

With the exception of null, in_expx and out_expx, this is a pure python port of "Penner's Easing Functions", based on the js code from https://easings.net where you can also see a catalog of them in action to chose the right one.

The following functions are included:

in_back         out_back        in_out_back
in_bounce       out_bounce      in_out_bounce
in_circ         out_circ        in_out_circ
in_cubic        out_cubic       in_out_cubic
in_elastic      out_elastic     in_out_elastic
in_expo         out_expo        in_out_expo
in_quad         out_quad        in_out_quad
in_quart        out_quart       in_out_quart
in_quint        out_quint       in_out_quint
in_sine         out_sine        in_out_sine

Additionally, I added a 'null' function, so easing can be disabled without changing the interface in the application. It's basically a nop.

null(t) -> t

In case you want to control the easing function by user input, the easings dictionary provides a map from function names to functions, e.g.

eased = rpeasings.easings['out_elastic']

To use any of the included functions, create a t (for 'time') value in the range 0-1 from your required range (e.g. t = current / max).

Putting this t into most(!) easing function, will give you a new 'eased' value in the range 0-1.

Note: the following functions over-/undershoot:

`in_back`     `out_back`     `in_out_back`
`in_elastic`  `out_elastic`  `in_out_elastic`

You can then use this value as a factor or e.g. as input for another lerp function.

Have fun, once you started using one, you'll probably find usecases for them everywhere in your game...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rpeasings-0.4.1-cp312-cp312-win_amd64.whl (13.5 kB view details)

Uploaded CPython 3.12Windows x86-64

rpeasings-0.4.1-cp312-cp312-win32.whl (12.3 kB view details)

Uploaded CPython 3.12Windows x86

rpeasings-0.4.1-cp312-cp312-musllinux_1_2_x86_64.whl (24.8 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

rpeasings-0.4.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (24.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

rpeasings-0.4.1-cp312-cp312-macosx_11_0_arm64.whl (12.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rpeasings-0.4.1-cp312-cp312-macosx_10_13_x86_64.whl (12.4 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

rpeasings-0.4.1-cp311-cp311-win_amd64.whl (13.5 kB view details)

Uploaded CPython 3.11Windows x86-64

rpeasings-0.4.1-cp311-cp311-win32.whl (12.3 kB view details)

Uploaded CPython 3.11Windows x86

rpeasings-0.4.1-cp311-cp311-musllinux_1_2_x86_64.whl (24.5 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

rpeasings-0.4.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (24.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

rpeasings-0.4.1-cp311-cp311-macosx_11_0_arm64.whl (12.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rpeasings-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl (12.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

rpeasings-0.4.1-cp310-cp310-win_amd64.whl (13.5 kB view details)

Uploaded CPython 3.10Windows x86-64

rpeasings-0.4.1-cp310-cp310-win32.whl (12.3 kB view details)

Uploaded CPython 3.10Windows x86

rpeasings-0.4.1-cp310-cp310-musllinux_1_2_x86_64.whl (24.4 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

rpeasings-0.4.1-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (24.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

rpeasings-0.4.1-cp310-cp310-macosx_11_0_arm64.whl (12.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

rpeasings-0.4.1-cp310-cp310-macosx_10_9_x86_64.whl (12.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file rpeasings-0.4.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rpeasings-0.4.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rpeasings-0.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9f09f6026475ce5826f0af7ad7f35e142463cacb0671e19eacc4d185fb593193
MD5 c38ca5f215043ab7c41a345e2cfe0080
BLAKE2b-256 cd57eb01d60fc3d787700c88a0bb0258417577a780c53da667905a3e58b36fd4

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp312-cp312-win32.whl.

File metadata

  • Download URL: rpeasings-0.4.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rpeasings-0.4.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 9bf6f1d8b7f8163b63314bcfea97c76094167b992cfc1a04f9871e375537abce
MD5 1b5ce5af99b75c1897947b950f253ee5
BLAKE2b-256 20e7f1b9a321112089fa0a7665cbfb850b07f02905e16c9323ad49e7e9f4e60c

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a85884c0070adf072a9d6e4196eea7b7d604178f86293c12c534cdbaf6a12510
MD5 cbe55bc58562502f7486e1bd9d59d4aa
BLAKE2b-256 44bf5f6a6b142890b3f61f007f26527b427e9e05e5b8cd99a7e40101986d7db7

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 d8d7ede1a9f1faeaf7eca0778f53cb70b0a0c41a4c9d5961135b41f1c71c07c6
MD5 4be2e61326dd8ffd7b3cf1555c85511e
BLAKE2b-256 07dd02f13b857d96fddb338c16e14a5a765886a5ad2cda1e62aa4814f31d1ada

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 44c4627dd6bc74fd1cb819e5256d525ecc9fade388371e389036263eeee6577b
MD5 358d0a0660336408ba67693f4a259636
BLAKE2b-256 80aea869c91c6b9500c49341426392fb23b7fa86b23be5e06ad1c9f1eaa0ec68

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 24c4c3add025206f244c022459e9cbb41bc6c99fdceab4c5d73ca5c85c5d1349
MD5 f049cd0a89a21699fe4993cef20d3e2e
BLAKE2b-256 144c38d02471e5a2e779fde01c084fbecdbabf5481f5a11114db3dd161b52d46

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rpeasings-0.4.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rpeasings-0.4.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c0aa2b37a1030f0013424cdfad0bd68acf47cdb8b00b24dd077675c299fa3214
MD5 ab6bcf2fdcc2acdad7de1680b9436916
BLAKE2b-256 43276c597fe6e26818c7ac5401342cd5c946a507c011604a758dd644f373dce0

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: rpeasings-0.4.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rpeasings-0.4.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 42acb7be87b9328a0fc4e36722746ed0a22c7791e675dd5bb0aec06181ade9d9
MD5 e6f1da7a9be00ae035c2bc18c0651a6b
BLAKE2b-256 63bf9e734f3b6dcf2229c4174d48b1f404f107fdb954b76b8e801e519c9160e7

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f3999b3e00db76351b6a2987248822acc882c870f40618b079647c3ff9b98223
MD5 deffcda96c15935e1521331f9bcfc185
BLAKE2b-256 a3687ebf008519197c4d78d08deeafe48a1f19ffdd2f6381cc77ce997fca16c3

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 84532f9cc086bce461f653d3ac38ab292b0e659f214a8381ea86d081e400d3c0
MD5 25b18edbf556e7c6435feb7b8d844c43
BLAKE2b-256 377fd89c80b80b7f20790a17eb8f40f5cb2d3629cc1781436cf9bce4e043f2ad

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd75c7b2f93fd28ec6a729216ae2844f313bc0492dc83d471c1b50c47435d5d2
MD5 99860acc018229f3f869dfd2da3e5316
BLAKE2b-256 5b0c7a3e3b92fdde43f77eb415e0e30897b1e8765fa32266b43434923bf24775

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 80223ed33341031fa312a6c1361f7f27f3cc0ffe2418a42e00e00ee3b22c0610
MD5 35394deb9206aa2ba25177e625eef95b
BLAKE2b-256 3df9797eceb82a9ab1bbe7b6f6719e1a936d0607a7fad12bc55ca9510d105cbd

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rpeasings-0.4.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rpeasings-0.4.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f5de299ffbc537d7a8d1ff8952da5305975eae0ea0c2a670141c9a6f1bd3b6eb
MD5 2c41170f2ee76f1cf5bf5fa44bc4ea85
BLAKE2b-256 3d336b778dc1beab4959bbeb1ed9a93d816ad4e7c1e474bf5a590e1f5eb7cffd

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: rpeasings-0.4.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rpeasings-0.4.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 99ba9c322d1ff09a578371798d5eea5c8a51d833894828d39c30df9394250631
MD5 c9478c4a088402a00904ccce532fdd97
BLAKE2b-256 e8e64f003037b697e9c6d11d38f9a5401594e0059ec8826b6428a8138f300d7d

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0fcbe985c026274396bfb272b845fd8a19334fdb1f2beb953183dae1ffce278b
MD5 af9528855f3ce4be2a98bc6647dc6951
BLAKE2b-256 f1f3ba7275d8ce8d40825b2aaedf135ad9dcf6bd058ed1de66f286119b66069c

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 2794ef1f31a26a8f21c4b51ddb5aa204484518d38c31a2a15960773cf8c1d02e
MD5 deba97a1452111387e5ed0dea8d12df2
BLAKE2b-256 735995d5c46714d99feb244fedb8956e7a078038e46ad634a8a9aead3da173f2

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86bdbb521ab91beb5a7571d59dfb891491de6f30db365bf746f8f80de9912696
MD5 73cb40fb9be9eabee079869e8ec5c460
BLAKE2b-256 ab725c2861b97eacd8ea46952b87d06a2c9fb727fe1acba23f335171e0585f98

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8eeabb5283695db291dda26206288b0401cf51a227a022b6e4fe971737d36096
MD5 4ef864cdf5296e778d748f5a6e2f5503
BLAKE2b-256 43be016e9746cf542a47d3c6145a8868e774cc3092f0aeb18728ac8028cda8ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page