I think the drag control is a bit tricky…let’s figure out if is possible to improve it!
(hope is in the right category, if not move it please)
SPACE/TIME RATIO
the ratio between the mouse position and the slider position seems to be fixed, something like 100px/1s, this is fine when you understand how does it works: if I’ve to move my slider for 500px, so I’ve to move it in a time window of 5 seconds, so it follows the mouse position.
…but, if you scale the element you loose completely the sync between mouse position and the element position :’( Of course you can manually adjust the speed but if the layout is flexible there’s no way to do it.
You can find here this example/test: Slider.hype.zip (28.1 KB)
Is there some kind of technique to avoid this for flexible dimensions? Would be great if Hype would manage this automagically…like checking if the element which is calling the drag event is scaled or not, for example.
EXECUTE ACTIONS
2. If I try to create a switch element, using two keyframes (at the beginning / end) to control 2 different actions (change slide, change timeline, javascript…), it doesn’t always work: is not 100% reliable.
Basically it works only if the “Continue after drag” option is active and you don’t move the timeline till the end, so (if you’re lucky ) Hype plays by itself the rest of the timeline till the end (or the beginning) and the call works.
this is a common hype-problem. i posted this problem in march:
in your example, if you turn on flexible layout and set the "Wrapper" to scale per size, including context,
the mousecorsor moves slowlier than the slider itself.
there´s no solution for this problem at this moment.
That’s exactly what I was talking about, but no solutions it seems…
SO…I spent my free time of the last days crushing my head on my Mac to find a workaround, and today I finally came out with a working script to trick Hype!
PS
I know is pretty complicated and requires an hidden Timeline and…blablabla…but I tried hard to overwrite Hype while its moving the handler and I couldn’t make it in that way… :’( I hope somebody can write something cleaner and easier following my approach!
PPS
I know there’s a bug in the scale load at the first call: I was too lazy to fix it since is just for debugging
cool, seemed to work. my solution was to create a persistant symbol.
then create for each screen a layout and scale the persistant symbol to this size.
works, too.
Just wanted to reiterate this since it isn't well known: this is the correct formula. At the 100% speed setting it is 100px of finger movement is 1 second on the timeline.
Yes, I do consider this a bug.
Very cool!!!
One small thing that stands out is you're looking at the matrix from the transform; is there a reasons Hype's getter API can't be used since it exports the scaleX/scaleY properties for reasons like this?
I'd also say a more simple solution may instead be to simply drive it all by javascript; if you know the element you can use the approach to find the scale factor, and if you set a timeline to target, then you could just set the time directly on that. But Hype should help handle this .
There's no reason why I used the transform matrix instead of the API, but in fact using hypeDocument.getElementProperty(parentElement, 'scaleX') returns always 1...so I unconsciously did a good thing!
So I think we have also discovered another problem: