moving layer when key pressed
Hi,
I am trying to add an interaction. It consists in moving a layer on Y axis when a key is pressed.
The media is loaded in a column. I start the column, and at on time i need to press the key to animate the layer on the Y axis at a specific rate.
For now i am able to add keyframes on a timeline but then you have to hardcode it (i need to trigger it manually). I tried also a Key interaction with accumulate but you can't manage the animation speed.
not sure i am very clear....
Comments
Hello @Martial,
If you want to control how fast your layer is moving with an interaction, a solution would be to create a simple script to do so : it could have a "speed" parameter, so you bind it to an interaction to control the speed.
See this example :
Parameter.createParameter("target layer", "Layer") Parameter.createParameter("speed (px/s)", 1) framerate = 60 setInterval(function() { speed = Parameter.get("speed (px/s)") layerName = Parameter.get("target layer") position = Millumin.getLayerPosition(layerName) position.x += speed/framerate Millumin.setLayerPosition(layerName, position.x, position.y) }, 1000.0/framerate)Best. Philippe