You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.6 KiB
85 lines
2.6 KiB
2 years ago
|
Metadata-Version: 2.1
|
||
|
Name: pytweening
|
||
|
Version: 1.0.4
|
||
|
Summary: A collection of tweening / easing functions.
|
||
|
Home-page: https://github.com/asweigart/pytweening
|
||
|
Author: Al Sweigart
|
||
|
Author-email: al@inventwithpython.com
|
||
|
License: MIT
|
||
|
Keywords: 2D animation tween tweening easing
|
||
|
Platform: UNKNOWN
|
||
|
Classifier: Development Status :: 5 - Production/Stable
|
||
|
Classifier: Environment :: Win32 (MS Windows)
|
||
|
Classifier: Environment :: X11 Applications
|
||
|
Classifier: Environment :: MacOS X
|
||
|
Classifier: Intended Audience :: Developers
|
||
|
Classifier: Operating System :: OS Independent
|
||
|
Classifier: License :: OSI Approved :: MIT License
|
||
|
Classifier: Programming Language :: Python
|
||
|
Classifier: Programming Language :: Python :: 2
|
||
|
Classifier: Programming Language :: Python :: 2.7
|
||
|
Classifier: Programming Language :: Python :: 3
|
||
|
Classifier: Programming Language :: Python :: 3.4
|
||
|
Classifier: Programming Language :: Python :: 3.5
|
||
|
Classifier: Programming Language :: Python :: 3.6
|
||
|
Classifier: Programming Language :: Python :: 3.7
|
||
|
Classifier: Programming Language :: Python :: 3.8
|
||
|
Classifier: Programming Language :: Python :: 3.9
|
||
|
Description-Content-Type: text/markdown
|
||
|
License-File: LICENSE.txt
|
||
|
License-File: AUTHORS.txt
|
||
|
|
||
|
PyTweening
|
||
|
==========
|
||
|
|
||
|
A collection of tweening / easing functions implemented in Python.
|
||
|
|
||
|
Example Usage
|
||
|
=============
|
||
|
|
||
|
All tweening / easing functions are passed an argument of a float from 0.0 (for the beginning) to 1.0 (for the end) of the tween:
|
||
|
|
||
|
>>> pytweening.linear(0.5)
|
||
|
0.5
|
||
|
>>> pytweening.linear(0.75)
|
||
|
0.75
|
||
|
>>> pytweening.linear(1.0)
|
||
|
1.0
|
||
|
>>> pytweening.easeInQuad(0.5)
|
||
|
0.25
|
||
|
>>> pytweening.easeInQuad(0.75)
|
||
|
0.5625
|
||
|
>>> pytweening.easeInQuad(1.0)
|
||
|
1.0
|
||
|
>>> pytweening.easeInOutSine(0.5)
|
||
|
0.49999999999999994
|
||
|
>>> pytweening.easeInOutSine(0.75)
|
||
|
0.8535533905932737
|
||
|
>>> pytweening.easeInOutSine(1.0)
|
||
|
1.0
|
||
|
|
||
|
The getLine() function also provides a Bresenham line algorithm implementation:
|
||
|
|
||
|
>>> pytweening.getLine(0, 0, 5, 10)
|
||
|
[(0, 0), (0, 1), (1, 2), (1, 3), (2, 4), (2, 5), (3, 6), (3, 7), (4, 8), (4, 9), (5, 10)]
|
||
|
|
||
|
The getLinePoint() function finds a point on the provided line (even if it extends before or past the start or end points):
|
||
|
|
||
|
>>> getLinePoint(0, 0, 5, 10, 0.0)
|
||
|
(0.0, 0.0)
|
||
|
>>> getLinePoint(0, 0, 5, 10, 0.25)
|
||
|
(1.25, 2.5)
|
||
|
>>> getLinePoint(0, 0, 5, 10, 0.5)
|
||
|
(2.5, 5.0)
|
||
|
>>> getLinePoint(0, 0, 5, 10, 0.75)
|
||
|
(3.75, 7.5)
|
||
|
>>> getLinePoint(0, 0, 5, 10, 1.0)
|
||
|
(5.0, 10.0)
|
||
|
|
||
|
Support
|
||
|
-------
|
||
|
|
||
|
If you find this project helpful and would like to support its development, [consider donating to its creator on Patreon](https://www.patreon.com/AlSweigart).
|
||
|
|
||
|
|