Advertisement
hrkpg2017

cycle_video_rotate

Aug 28th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. function cycle_video_rotate(direction)
  2. -- Calculate what the next rotation value should be.
  3. newrotate = mp.get_property_number("video-rotate")
  4. if direction == "clockwise" then
  5. newrotate = newrotate + 90
  6. else
  7. newrotate = newrotate - 90
  8. end
  9. -- Wrap value to correct range (0 (aka 360) to 359).
  10. if newrotate >= 360 then
  11. newrotate = newrotate - 360
  12. elseif newrotate < 0 then
  13. newrotate = newrotate + 360
  14. end
  15. -- Change rotation and tell the user.
  16. mp.set_property_number("video-rotate", newrotate)
  17. mp.osd_message("Rotate: " .. newrotate)
  18. end
  19.  
  20. mp.add_key_binding(nil, "Cycle_Video_Rotate", cycle_video_rotate)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement