User Tools

Site Tools


gestures:touch:complex:velocity-direction:n-flick

N-Flick

(Touch → Complex → Velocity & Direction → Simple N Point Flick Gesture “N-Flick”)

The 'n-flick' gesture can be activated by any number of touch points. When a touch down is recognized on a touch object, the velocity and acceleration of the touch points are tracked. If acceleration of the cluster is above the acceleration threshold a flick event is dispatched.

The acceleration threshold is defined in the “<variables>” tag in the “<analysis>” block. In the example below the var=“etm_ddx” has an allowable min value of var_min=“2”. This sets minimum value of two on the variable “etm_ddx” (mean acceleration in the x direction). IF the average group acceleration of the touch point cluster is below 2 pixles per second per second the return value of the dimension is set to zero. If both dimensions are have zero value the gesture will be put in an inactive state and no event will dispatched.

<Gesture id="n-flick" type="flick">
<!--The 'n-flick' gesture can be activated by any number of touch points. When a touch down is recognized on a touch object, the velocity and acceleration of the touch points are tracked. If acceleration of the cluster is above the acceleration threshold a flick event is dispatched.-->
    <match>
        <action>
            <initial>
                <cluster point_number="0" point_number_min="1" point_number_max="5" acceleration_min="0.5"/>
                <event touch_event="touchEnd"/>
            </initial>
        </action>
    </match>
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="flick"/>
            <variables>
                <property id="flick_dx" var="etm_ddx" return="etm_dx" var_min="2"/>
                <property id="flick_dy" var="etm_ddy" return="etm_dy" var_min="2"/>
            </variables>
            <returns>
                <property id="flick_dx" result="etm_dx"/>
                <property id="flick_dy" result="etm_dy"/>
            </returns>
        </algorithm>
    </analysis>    
    <mapping>
        <update dispatch_type="discrete" dispatch_mode="cluster_remove" dispatch_reset="cluster_remove">
            <gesture_event  type="flick">
                <property ref="flick_dx" target=""/>
                <property ref="flick_dy" target=""/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>

When the matching criteria for this gesture is met and the values returned from analysis are below the acceleration threshold the gesture object as defined by the above GML will return the flick velocity “etm_dx” and “etm_dy” to the dimension “flick_dx” and “flick_dy” respectively. These dimension values can be directly accessed via the gesture event object.

gestures/touch/complex/velocity-direction/n-flick.txt · Last modified: 2019/01/29 19:07 (external edit)