When an event is started, is it possible to stop it before it has ended?

Concerning Events: When an event is started, is there a possibility to stop the event before it has ended?
For example: Starting a actionSetXWithAnimation with a duration of 1 sec, a button is pressed (or any other signal) after 0,5 sec then the animation stops?

See the rotation.pma example.
XY-origin with User Code for the Article widget and stop animation with the Action Editor (run actionSetXWithAnimation with both current position and duration set to 0).

I use a gallery with user-code:

MultiPointTouchArea {

anchors.fill: parent

maximumTouchPoints: 3

onTouchUpdated:{

if (touchPoints.length>0){

rotationZController.origin.x = touchPoints[0].x

rotationZController.origin.y = touchPoints[0].y

blockData.scriptAdaptor.actionRotate(blockData.rotationZ+10)

}

}

}

When I click for the first time on a certain point in the gallery, the rotation works well.

When I click multiple times on the same (rotated) point, the rotation-origin stays.

But when I then use another position in the gallery for clicking, the rotation-origin is “somewhere” else, neither the old, nor the new position.

It seems, the origin is updated only once??

How can I avoid that?

And where is rotationZController inherited from? Does it belong to block or blockData?

What I´m trying is:

When I touch a widget with TWO or MORE fingers, the widget can be scaled and rotated.
BUT the origin for rotation and scaling should be the centerpoint of the fingers.

If there´s no possibilty, I will try to code within the “MultiPointTouchArea”, compare old touchPointlist with actual list, calculate rotation and transformation matrices …

ANOTHER important question:
Is there a easy possibility to start a sound when a button is pressed?
Should I use an invisible audio-widget?
How can I start the playback in script (is there a action for that)?

Also with video: I would like to have my custom control (play-button, pause etc.). How to start video, pause or set the playbackposition (to use custom slider)?

By default the rotation is at the center of the fingers. Maybe you need to disable the Moving widget?
Yes, you can use the invisible Audio widget.

To control the Video/Audio widgets:

blockData.delegate.scriptAdaptor.actionPlay()
blockData.delegate.scriptAdaptor.actionPause()
blockData.delegate.scriptAdaptor.actionStop()


Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.