Need "setElementProperty" method has callback [solved]


I have a problem,when i did “setElementProperty”,I want to do other things. but that’s not real continuous.

for example

  hypeDocument.setElementProperty(element, propertyName, value, optionalDuration, optionalTimingFunctionName);

and correct method is

hypeDocument.setElementProperty(element, propertyName, value, optionalDuration, optionalTimingFunctionName,function(){
 //to do
1 Like

I modify HYPE-596 file ,and it’s works fine

I like the idea and it is common in popular tweening engines. I also was missing a multi porperty solution so I made the extension setElementProperties (plural):

This extension could just be modifies to use a time out to trigger an onCompleteHandler.

BTW modifying the runtime is not a good idea as you will be reapplying your “patches” on every update of Hype and potentially every export of your project (depending how you set it up).

1 Like

Thx 4 your reply ,yours work is awesome and of a great inspiration to me.

yeap ,extension&plugs is a good way. I know inject runtime file seems rude :joy:

I’ll check other plugs libraries

From a Hype feature standpoint I’m curious what would be your expectation of this callback if the animation was interrupted by another timeline? Possible options:

  • callback is called at the duration time no matter what
  • callback is called immediately when interrupted
  • callback is not called

callbak when set animation is complete.

There are circumstances where it may not be able to complete, so I’m curious about your expectations in those situations.

I’d go for 3 (not called). If your goal is to fire in progression and the intended animation is paused or interrupted so should the progression. I’d also look at Greensocks tweenlite or tweenmax and how they go about it.

1 Like


My recollection from doing so a few weeks ago is greensock will chain commands and won’t interrupt, so it isn’t an issue for how they do animations.

Am I wrong in thinking if you introduced this as a feature you would be able to have a set of result codes to check against which would include codes for such interruptions and allow you to handle them depending on the result code?.

This could be a possibility; the standard for cancelable actions (like a network request) is to provide a success and error callback, but I’d also like to keep things simple.

1 Like

In TweeMax and TweenLite the onComplete never fires if you pause or kill a tween.


Cool, I missed seeing that, thanks!

I was still thinking about this. Using a complete handler is a valid way to implement the initial temporal cascade and is done so in TweenLite. But Hype has already the built in concept of a timeline that might also be a solution, given one could create a virtual timeline and add actions to it through code. One then could use all the usual and already known operations on it like play, stop and jumps to specific time indeces. That logic is already implemented in the runtime.

The setProperty-Call-Chain discussed here also could be added via an extension but also introduces a complete new stack of things to worry about and keep track of. Guess it would be the easier fallback if Hype doesn’t expose a proper virtual timeline API, though.

In fact, setElementProperty does make a timeline under-the-hood, so the most basic implementation of a callback is adding a timeline action at the end. This is what brought up my question of behavior; this timeline action would currently be called even if the property became owned by a different timeline, and I wasn’t sure this was in line with expectations. It would be interesting to expose the timeline identifier for control along with giving the ability to add animations/timeline actions to it.

1 Like