Kinetic: kinetic abstraction

Kinetic: kinetic abstraction

class pymt.ui.widgets.kinetic.MTKinetic(**kwargs)

Bases: pymt.ui.widgets.widget.MTWidget

Kinetic container. All widgets inside this container will have the kinetic applied to the touches. Kinetic is applied only if an children is touched on on_touch_down event.

Kinetic will enter in the game when the on_touch_up append. Container will continue to send on_touch_move to children, until the velocity Vector is under velstop and sending on_touch_up

from pymt import *
k = MTKinetic()
# theses widget will have kinetic movement
k.add_widget(MTScatterSvg(filename='sun.svg'))
k.add_widget(MTScatterSvg(filename='cloud.svg'))
w = MTWindow()
w.add_widget(k)
runTouchApp()
Parameters :
friction : float, defaults to 10

The Pseudo-friction of the pseudo-kinetic scrolling. Formula for friction is

acceleration = 1 + friction * frame_delta_time
velstop : float, default to 1.0

The distance of velocity vector to stop animation

max_acceleration: int, default to 50

Maximum acceleration allowed

process_kinetic()

Processing of kinetic, called in draw time.

Previous topic

MTImage: MTImage displays an image on the screen that can be repositioned.

Next topic

List: a list with kinetic effect

This Page