Giter VIP home page Giter VIP logo

pitweener's Introduction

This library provides many equivalent functions of Flash’s Caurina Tweener in cpython 2, cpython 3 and jython 2, and uses the same set of excellent easing equations by Robert Penner . In a nut-shell, it allows you to move objects with nice smooth acceleration and deceleration using a variety of methods. Plus you don’t have to worry about updating them. Any property that supports standard mathematical operations can be tweened. This is particularly useful with animations.

Example Usage

PiTweener itself is located in the src directory. Usage is fairly simple. At the initialization phase:

import PiTweener

tweener = PiTweener.Tweener()
# add a tween:
tweener.add_tween(
    my_rocket,
    throttle = 50,
    set_thrust = 400,
    tween_time = 5.0,
    tween_type = tweener.OUT_QUAD,
    on_complete_function = my_rocket.burn
)

# get a tween and modify it:
mt = tweener.get_tweens_affecting_object(my_rocket)[0]
tweenable = mt.get_tweenable("throttle")
tweener.add_tween(tweenable, change=1000, tween_time=0.7)
tweener.add_tween(mt, duration=-0.2, tween_time=0.2)

Unit Tests

Unit tests can be executed simply by running PiTweenerTest:

cd src; python PiTweenerTest.py

Documentation

The project’s documentation can be generated with Sphinx, the tool used to generate the official python documentation. On Ubuntu 10.04 (and probably Debian too) Sphinx can be installed through aptitude:

sudo apt-get install python-sphinx

The documentation can then be built through the included Makefile. For the html documentation, run:

make html

For the pdf documentation, make sure you have LaTeX installed and then run:

make latex

and then compile the pdf with latex by running:

cd doc/latex; make all-pdf

Note: If you are planning to use the html documentation with github pages, you must install sphinx-to-github first, and then run it on the generated html directory:

sphinxtogithub doc/html

Note: These instructions assume that you are running some operating system where you can use a bash shell. On Windows you can use the included bat files, and modify any relevant instructions accordingly.

pyTweener

PiTweener is a fork of pyTweener . It was forked by pipeep (get it?), to address a number of bugs in the pyTweener engine. In addition, PiTweener attempts to match python’s PEP 8 guidelines .

pitweener's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.