"Linear" might be a better option under certain circumstances... especially in a repeat loop on the same timeline. If both elements are running the same easing set-up I would think the outcome (positioning, etc.) would be the same.
In any event Hype is a great toolbox - and, as in this post - there are often different approaches that achieve the same result.
You can even pass arguments to the aliased hype function from thecustom Math Equation so you can run more that one set of elements from the same aliased hype function.
@h_classen is talking about the window scope your using to intermediate between the Hype Document and the the easing function. Usually not a problem but one tries to avoid it in a general solution. But whatever does the job specially for single cases.
Oh that global. There probably is I think I did it that way originally at the time because I did not find one when I was just trying to get it done quickly in a simple way.
True! and then (for more documents) one would have to make sure that the object keys array is sorted the same way just to be sure that index 0 is the same across browser. Not sure how reliable native object keys sorting is but the main problem with that approach is that naming of documents can change or if another document is named with Z or A it would either be appended or inserted at the brining of the list. So it is again page specific and not general.
Directly hardcoding the name of the document instead of the object keys would also be a solution just it would need to catch the case that Hype uses „index“ in previews rather then the export name. Not making live easy for us
Wow! Thank you so much @MarkHunte for taking the time and energy to do this. It’s fascinating and very helpful! I’m not experienced in this area enough to be able to understand deeply how it all works but at the surface level can see how the relationships between these three blocks of code are established. I’ll experiment with it further. Regards
For the global pollution… I think this is not a big issue as it is similar to what we do in the head with the call backs there.
So saying that a simple thing to do for more than one hype doc on the webpage would be the hype function as:
window[hypeDocument.documentName() ] = function(targetTofollow,follower,prop){
var EllipsePin_ = hypeDocument.getElementById(targetTofollow)
var Prop_ = hypeDocument.getElementProperty(EllipsePin_, prop)
var EllipseBlue_ = hypeDocument.getElementById(follower)
hypeDocument.setElementProperty(EllipseBlue_, prop, Prop_, 0, 0)
}
And you then just add what you would call the exported file to the Math Equation code as the function name called. Including an OR operator using ‘index’ so we can also run in previews.
function (t, start, dur) {
try{
let plc = window['pa1'] || window['index' ]
plc('egg','lem','left')
}catch(err){
console.log(err)
}
return t / dur;
}
For those of you wondering why we are using globals. It is because the Math Equations do not have access to the Hype document scope ( hypeDocument ) at run time