New logic brick proposal

Playing animation keyframes for how long as you press a keyboardkey.It would play less of the keyframes if you hold down the keyboard key for short time and more of the keyframes if the keyboard key is held down for a longer time.I think this would be a great addition to the logic bricks.

This is not a single logic brick. It combines sensing with actuating.

You can already do that with:

Keyboard sensor -> ActionActuator (loop stop)

You might mean to add a flag to the play mode that the play stops on deactivation of the actuator.

I want the animation to stop on the keyframe that you stop pressing the keyboard key.
So monster you probably are right.

You can hook up a keyboard sensor to an actuator that increases a float property. Then, hook up that same sensor to another actuator that sets the animation frame to the property you’re setting.

I don’t know if that is what i want.Please make me a blend example?

A .blend for you to see the different effect of the actuator modes to play animations.

This website will help you understand them all as well:

.blend: actActu.blend (554 KB)

There is also ways as monster suggests to stop it using also the play actuator. Here is how you would do that:

Add a property to the object let’s say called frameCount.
In the actuator option insert this property name where it says Frame Property.

Then can use a property sensor for that property, when ever it == the frame you want it to stop on, deactivate the sensor.

A third option, just use the built in python functions completely and forget the actuator, but this requires knowledge of coding, or at least using the API well.

Here you could examine related functions starting with playAction:

I would recommend using the actuator with loopStop for simplicity.