Duplicate/replace symbols in physics animation

Can anyone think of a way of either

  1. duplicating a symbol (or element) in a physics animation, or
  2. replacing it, in its current location, with one or more other symbols?

I presume this is impossible, as Hype doesn’t know where symbols/elements are once they have been acted on by gravity, etc. But thought I should check if any of you smart people can think of a workaround.

all elements have to exist before export.

This is true, there isn’t a way to instantiate symbols. But that doesn’t mean you can’t hide elements off scene and instantly place them where you want them in response to a trigger.

But… there is a method that @markhunte came up with to clone elements: Extend Tumult Hype with JavaScript: hypeDocument.extensions

Thanks @h_classen and @Daniel.

Am I correct in thinking that @MaxZieb’s wonderful element cloning needs to take the location at which the clone appears as an input? If so I can’t quite see how I could use it with physics, as gravity will already have moved the elements that I need to divide into two, so I don’t know where to put the clone so it is colocated with the original.

Ah … And Hype opened a Bridge to the included javascriptlibrary matter.js which is used for physics …

So you would bei able to achive your Goal …

Cloning was done by @MarkHunte

Ah, but unless I’m missing something we’d need a hypeDocument.getElementProperties first so we knew where to put the clone. As far as I can see there is only a setElementProperties so far…

Here it is: https://tumult.com/hype/documentation/#getElementProperty

1000 apologies, I was assuming it would be in @MaxZieb and @MarkHunte’s extension set, and forgot about the core API functions. I’ll probably be back once I’ve had a try…

I am still waiting for true symbol attachments directly from the resources library on the fly. Including functional timelines. Everything else is nice but requires pure JavaScript to animate or interact with the newly cloned elements.

1 Like