Drag controlled rotation

All:

Brain Lock here…
I have built slider controls vertical and horizontal without issue.
But I am trying to make a control that allows the user to drag on an object and it will then rotate around the set axis.

I am somewhat of the way there.
I can drag on the element
it will control the timeline of choice “turn”
However I want to be able to drag it in both directions let it set at any angle when I let go.

What have I forgotten?
Thanks!
Nick

turn.zip (12.2 KB)

Ugh I think I have it.
Not very elegant though.
I put a pause timeline action on every frame…
prototype.zip (35.9 KB)

Did you try unchecking “Continue after drag?”

I think to do this right you won’t want to use the built-in Control Timeline action. Instead I’d do something like:

  1. Add a Run JavaScript for the On Drag
  2. With the event['hypeGestureXPosition'] and event['hypeGestureYPosition'] use trigonometry to calculate the angle of rotation that the cursor is at
  3. Convert this to a percentage of the timeline that is complete
  4. Convert the percentage to a time on the timeline via hypeDocument.durationForTimelineNamed()
  5. Drive the timeline with the time via hypeDocument.goToTimeInTimelineNamed() API function
1 Like

Thanks @jonathan I will try it.
I won’t need super exact control since this is for a drag illustration model.
And turning off the continue after drag did work…time for more coffee.

1 Like