회전은 다이얼의 rotation
값에 바인딩 할 것으로 보인다. 양수/음각은 시계 방향/시계 반대 방향을 의미합니다.
단추를 어느 방향으로 돌리려면 현재 각도와 이전 각도를 비교해야합니다.
var previousRotation = 0;
Draggable.create('#dial', {
type:'rotation',
throwProps: true,
onDrag: function() {
var yourDraggable = Draggable.get('#dial');
var dir = (yourDraggable.rotation - previousRotation) > 0 ? "clockwise" : "counter-clockwise";
console.log("Direction: " + dir + ", angle: " + yourDraggable.rotation);
previousRotation = yourDraggable.rotation;
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenLite.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/utils/Draggable.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/plugins/CSSPlugin.min.js"></script>
<img id="dial" src="http://greensock.com/wp-content/uploads/custom/draggable/img/knob.png" width="250" height="250">
우수! 빠른 답변 감사합니다. – Jetchy