GithubHelp home page GithubHelp logo

pyflax's Introduction

PyFlax

##Pure python tweening library

This is python flax, just like flax moves in the wind so will your vars, it is inspired by: https://github.com/rxi/flux

##Install to install simply drop the Tween.py in your project

##Design Its mainly designed with classes in mind and modifiying the vars that they hold, however it can also modify independent vars too. The only thing you need is delta time. ##Easing Currently theres only "Linear" easing however you can easily add your own easing types in the Tween.py dictionary called "ease" ##Usage vars is a dictionary list reflecting your class and expected value

Timer.to(time,object,vars,easing)

*default easing is "Linear"

from Tween import Tween
timer = Tween()
class box(x,y)
  def __init__(self,x,y):
      self.x = x 
      self.y = y 
inst = box(0,0)

tween = Timer.to(1,inst,{"x":20})

#your update loop 
timer.update(dt)

This will move the box from 0 to 20 in the x direction in 1 second. #Advanced(Untested): You can use a list as your var/item see:

inst.color = [0,0,0]
tween = Timer.to(1,inst,{"color":[255,255,255]})

schedule another tween:

inst.color =[0,0,0]
inst.x = 0 
inst.y = 0 
tween = Timer.to(1,inst,{"x":100,"y":100).after(1,{"color":[255,255,255]})

This will move the box to [100,100] in 1 second and after set its color from [0,0,0] to [255,255,255]

You can have as many vars as you want but they must be int.

##Planned features: stop a tween sequence. other types of easing, eg elastic and interface for costum methods. shortcut for creating single var tweens.

pyflax's People

Stargazers

 avatar

Watchers

James Cloos avatar  avatar Mikus 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.