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 Distribution

rpeasings-0.4.5.tar.gz (11.8 kB view details)

Uploaded Source

Built Distributions

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

rpeasings-0.4.5-cp313-cp313-win_amd64.whl (16.9 kB view details)

Uploaded CPython 3.13Windows x86-64

rpeasings-0.4.5-cp313-cp313-win32.whl (16.4 kB view details)

Uploaded CPython 3.13Windows x86

rpeasings-0.4.5-cp313-cp313-musllinux_1_2_x86_64.whl (30.5 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

rpeasings-0.4.5-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (30.6 kB view details)

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

rpeasings-0.4.5-cp313-cp313-macosx_11_0_arm64.whl (15.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rpeasings-0.4.5-cp313-cp313-macosx_10_13_x86_64.whl (15.6 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

rpeasings-0.4.5-cp312-cp312-win_amd64.whl (16.9 kB view details)

Uploaded CPython 3.12Windows x86-64

rpeasings-0.4.5-cp312-cp312-win32.whl (16.4 kB view details)

Uploaded CPython 3.12Windows x86

rpeasings-0.4.5-cp312-cp312-musllinux_1_2_x86_64.whl (30.4 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

rpeasings-0.4.5-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (30.6 kB view details)

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

rpeasings-0.4.5-cp312-cp312-macosx_11_0_arm64.whl (15.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rpeasings-0.4.5-cp312-cp312-macosx_10_13_x86_64.whl (15.6 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

rpeasings-0.4.5-cp311-cp311-win_amd64.whl (16.9 kB view details)

Uploaded CPython 3.11Windows x86-64

rpeasings-0.4.5-cp311-cp311-win32.whl (16.4 kB view details)

Uploaded CPython 3.11Windows x86

rpeasings-0.4.5-cp311-cp311-musllinux_1_2_x86_64.whl (29.7 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

rpeasings-0.4.5-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (29.9 kB view details)

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

rpeasings-0.4.5-cp311-cp311-macosx_11_0_arm64.whl (15.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rpeasings-0.4.5-cp311-cp311-macosx_10_9_x86_64.whl (15.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

rpeasings-0.4.5-cp310-cp310-win_amd64.whl (16.9 kB view details)

Uploaded CPython 3.10Windows x86-64

rpeasings-0.4.5-cp310-cp310-win32.whl (16.4 kB view details)

Uploaded CPython 3.10Windows x86

rpeasings-0.4.5-cp310-cp310-musllinux_1_2_x86_64.whl (29.7 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

rpeasings-0.4.5-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (29.8 kB view details)

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

rpeasings-0.4.5-cp310-cp310-macosx_11_0_arm64.whl (15.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

rpeasings-0.4.5-cp310-cp310-macosx_10_9_x86_64.whl (15.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file rpeasings-0.4.5.tar.gz.

File metadata

  • Download URL: rpeasings-0.4.5.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for rpeasings-0.4.5.tar.gz
Algorithm Hash digest
SHA256 67889809eb571be86c4becd3f70baf37d71d9075ebed410bd62b827a00727ad2
MD5 6801cf1c3fadac2c614f9607fce3c789
BLAKE2b-256 7bfa11dad67b2c6989635ca2ac328004a88765cd98c57a20a9007dd6db30d370

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rpeasings-0.4.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for rpeasings-0.4.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9c9b2317b56b82b547054d78bdcd5cc8c83a9cbba452fb07c0d44dea4b2729d1
MD5 b7e254050837c7a954e99e0769febd98
BLAKE2b-256 f4e14db1427901a9dbd477d2aaa03c0aee48d94b5a0cbe2f4a1bc4d5bb135559

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.5-cp313-cp313-win32.whl.

File metadata

  • Download URL: rpeasings-0.4.5-cp313-cp313-win32.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for rpeasings-0.4.5-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 4150bc44fc437da70a7abc785e9ecf0d1726d465ba97024ee6feaba1901bf2fb
MD5 21b10918d21a376083ee26331c6039bc
BLAKE2b-256 e4a1bb909165ce222b9b0749cfcffe4959a3600cb6248bc5ef000adf0eff5b16

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.5-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dde41e34c1ec316411037aaba2d107df944669bbfbe0c11f6d89758d36e27354
MD5 e68c7dbc530263065c0c1e6388d2371e
BLAKE2b-256 dcbbfc87e786b894a046d71ce2ad0d72db94d4ecc429e8b33ce85141170ab3d4

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.5-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 ad8de762e3eb51a0971a707253a04b940b846c12579855f6831ed9f88830c231
MD5 b0cdab5a1712171be8b4c7799a3ae09f
BLAKE2b-256 03f997122a53ef7e4c55b4a1cc660b12d23ea39febf97385a56941ccde794988

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8035b4bf5d0a8e8e5c6d530fc03554b2118ab9bf5343e7fddddaf663388277d2
MD5 6089d3ff27a1113b6dffe799ffefe0e6
BLAKE2b-256 a82ce17e7acd7fd1840f0e4e375d7bebb4adf4adae4c7386e85d2e10341968d1

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.5-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 09981729fdc9c024830c9064cceb8fe86548aec3fc04d79f386a175ba676b62d
MD5 c241464bb7badb204303a69a5298527e
BLAKE2b-256 3e89eadc57a36faad156a25a294f25bc22d92febe1d5eecca62a019419dcbd8b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rpeasings-0.4.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 28133d2b8abeb431558641da6131d641a6c52ac63d5a784bb41487abf0a4c531
MD5 37fcf371643ba6c923617b97f85aede6
BLAKE2b-256 74bd1c617f9ac1b7aed3e4781c1e4a93a462a29503cbc32763714a95fc9805fc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rpeasings-0.4.5-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 2b6e15ce14fdd86c93f9271cd3d396aca37b866fbc1bd58fdd596a7448eaad11
MD5 8e79ed7e1b7eb41e3e96ad1b913e066c
BLAKE2b-256 d1ebda69deb50203e35dc39f52d8113c5ad64c98ef7fc47c9789f5d863ca52b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8d71fd234c59df1c9b43f6b29289a227aeb62f1d98e803ee19e6016967737636
MD5 e07478e31026369700fd3786945a884f
BLAKE2b-256 403efd8baae47cb9d6ac8a34f5a73f36997f377f9802d575462674833612ad83

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.5-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.5-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 c2393644b81619df4a90892f7080016b0eecc9c8c9f23d94c5dfef9d9c01f094
MD5 35cba254fcc4b95bebc5df45cbf519d8
BLAKE2b-256 6aa288a0185708c0f755e1157aa9e5ca1fc37360a7e9e98c0de8938677782440

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 24e6d21dd4a0b2e65469cd5cd8b469bdbb3ffb2f65df6050c3f7c3632238de8c
MD5 a2a8052a46492836b821cb886df1db36
BLAKE2b-256 3ac1d3ef97fc0b85127f6e9ec70196dcb3374a435f375750b3181c08fd034f7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2c7603791a367fa64546e7b43b6cd2bbc97bffece487702a4fd485d79b02762f
MD5 eeacc2a8b97661f0ca7e6643244f8ad9
BLAKE2b-256 de0b1c130154fec58a117ee60e8bd5fa612d4768c58359b5fb8d8ee092e3ff7b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rpeasings-0.4.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 27b43036868987c72bbe29dc18a635e71f1523f1b0194a9ac67e3fac64293cad
MD5 99d11629f05efdd63a2ba94de293aae2
BLAKE2b-256 b7ac539b0ba9c8b60669496e8b62f3729c2b0d3e2e8d5b26139d596de19031b8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rpeasings-0.4.5-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d53a38cdeb73366b2c41ba0f105639b31c81dc3793ba121cd6174141c5a8a913
MD5 632b69f08ac304a773991279a4451ec3
BLAKE2b-256 805d144c3634a7dce37088b09402f94d4384f662b152f34d54d1656d77328d1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 531d49c713424704fcc7e63220dd491866490b29a5d86b0d027618b552bf45f3
MD5 6bb27d3b3bd4d433196244f3201acdec
BLAKE2b-256 91309d7dfe633adfece6819f5d7cdd5e929227855e242aa8aa0f177383f6657e

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.5-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.5-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 896d3a8281571ecdc160b4a1edc2dac6cbf50bea570cee23bc70ddf7b7b94191
MD5 921ed2594e35480d091ad2ee3970de05
BLAKE2b-256 9c1d1ab122e0ddf76008103daa6c2b087a4686207aa6f15983bda0dec23f3f01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4fce2518469b7ce8d349213a6445f9a81a7b8468755751e10274574d7c660cf2
MD5 382b3b748d7058b36eec5bbbd3028bb3
BLAKE2b-256 d1330fa626eb2f6ebb5a48842f53703257f522f91d2c950189c89c75853b85de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 caaf57fc86d87e0ff7dd9ec1feb133955e690b225f1df0f52ad8ca8ace3167ee
MD5 57c85866d1756ccfe7bfbd4f1fcfbc08
BLAKE2b-256 11713c8cedf645ddc9eaa0bb00456f052a95d2565a9d58a7cdbe37031767402e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rpeasings-0.4.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 eea8975c69033a162f5c11652ae47124d7ac423bad211e2ca42df0602a4a2a91
MD5 6df241a51cbebe389cdbbf7231348459
BLAKE2b-256 8e836fc5db614c2f71b4b4470fe7f771030fbfb8c652e370b0f5e34f0adf87ed

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rpeasings-0.4.5-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 d8413e9546ffaadc1a79a213a9fd26afed58721371deac5e21d7cc75ce3fad45
MD5 5705b6d42bbf0c926be69c866b636420
BLAKE2b-256 00549b999ae52fead02f49056d0223185e32b6decd52c8dce9d67a1839ecca0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1c80acf37a7db3a553df95dd0fea1997cdd2d195e048ae79b69197f37a605fbc
MD5 7b0af935ba29215c1fc159ade6d121a3
BLAKE2b-256 f7d658f0082d073dca429fc4f0047a899d3706f65a5ddd36e78255076f13b2fc

See more details on using hashes here.

File details

Details for the file rpeasings-0.4.5-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.5-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 ecd424b8eb00d40922b362d913d9a552ac70f9810e5852a6f771d830bd1f8467
MD5 a79848ca3b306f5b00d0eb33e348b399
BLAKE2b-256 c2eb125f25fb9f0f13d513e1940f7da6ade691303395e8ef7db7795ea7db4a48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13017002348fb9a37f19dd36293859af77c5a1c4a35189512bee6a7241a57bf7
MD5 7ec1b890d0c786ad4822995c9984e481
BLAKE2b-256 32ae1e98f7c7d8d9f3df751514502185c5e05d410c1b446a5e8dfdedb1702954

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rpeasings-0.4.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9371e238ce4cbe2f3de4da4b2f72e2b7d36e64ad8e7d4ff3614faf5dad7d0beb
MD5 50b34cf208d27616a819b5240dc6f8ff
BLAKE2b-256 5ab8f96a83368b5e35982f6279cd799a12728f2dff38fae864caa36e775ae501

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