Multiple destination animation REPEAT

I just got hold of a multiple destination animation patch (from SugAR) and it’s great. Been trying to connect multiple animations with no such luck (turns out I needed to connect the reset inputs).

What I’m trying to find out is how to get the sequence of animations to repeat.

If anyone has any advice that would be great?

I’m so close to creating a filter I’ve been wanting to do for ages !!

Tommy

2 Likes

For some reason the animation patch does nothing if you try playing again immediately after it’s complete, but you can do something like this to trigger it to play immediately, then again after every 5.1s. The 5s is the total of all the durations, plus .1s to wait for it to settle before playing again

That worked a treat, would never have thought about doing that. One step closer !

Thank a lot. :slight_smile:

2 Likes

@josh_beckwith this has definitely solved one problem, the next one I can’t get my head around either.

Premise: I’m trying to replicate the classic DVD screensaver where the logo goes from edge to edge at random positions.

So far I’ve made a patch where I can get the random edge positions based on the screen size/scale and rectangle size.

I then made another patch which ensures the multiple animations play at the same speed.

This then outputs to the Multiple Destination Patch.

IDEALLY, what I want to to achieve is for each cycle of the animation to have to different destinations.

I can’t seem to find away to trigger the first patch (to generate new positions) before the next cycle starts.

If you, or anyone, has any ideas that would be great.


OK, if this is your goal, I would recommend a different approach. Instead of defining the end positions all at once, you can make a sort of game update loop.

  1. Update position based on movement vector
  2. Update movement vector based on hit detection

You can do this with the global transform patch since it allows you to read values from objects. It can be a null object, so you can read and write values to that and then apply that to something like rect position.

Of course, I know how all of this should work… but it doesn’t. I made a test project with this logic and it gets stuck on the edges and the position value won’t update. I’m attaching the project because I feel like it could be useful if we just solve the reactive weirdness. I’m guessing doing the old patch to script to patch would work more reliably than reading the values from global position.

spark-dvd.arexport (33.3 KB)

Maybe I’ll try again later, but here’s this project in case it helps. In any case, I think both of these projects need a similar solution. You can send the loop animation completed pulse to script land, then send it back to patches. This will get it out of the reactive loop so the cycle can be introspective.

1 Like

It sucks that none of my old tricks work for this any more, but I guess the idea is basically the same. Take the values out of the reactive loop and put them back in (with script).

You will need to monitor your signal and repackage the values into reactive signals, then send them back to the patch editor.

const Patches = require('Patches')
const {log, watch} = require('Diagnostics')
const R = require('Reactive')

;(async function () { 

  const motionVector = await Patches.outputs.getPoint2D('oMotionVector')
  const position = await Patches.outputs.getPoint2D('oPosition')

  position.x.monitor({fireOnInitialValue: true}).subscribeWithSnapshot({
    mx: motionVector.x,
    my: motionVector.y,
    px: position.x,
    py: position.y,
  }, (val, {mx, my, px, py}) => {
    const mv = R.pack2(mx, my)
    const p = R.pack2(px, py)
    Patches.inputs.setPoint2D('motionVector', mv)
    Patches.inputs.setPoint2D('position', p)
  })

  // set initial values
  Patches.inputs.setPoint2D('motionVector', R.pack2(2.4, 1.8))
  Patches.inputs.setPoint2D('position', R.pack2(1, 1))

})()

spark-dvd.arexport (55.9 KB)

1 Like

wow wow, tried to see this in action but somehow the fps drops significantly after a few seconds. even after pausing it was still moving.


1.2 fps

@josh_beckwith @Adi_Satrio

Thank you both for showing an interest and making an effort to find solutions ! Glad I found this forum !

I’ll continue to play around and try this new approach.

Tommy

1 Like

I might have left some log statements in the update loop. I noticed the log slows down the program if you are updating it every frame.

I don’t think log diagnostic is the culprit here. I commented the log and it still gradually lagging so hard after 2 second. maybe it’s the same problem under the hood like what happened in frame cache.

Yeah, most likely since it’s doing something similar with the script. I was thinking about this again today and came up with a possible solution, but it’s a pain. Basically you’d need to rewrite all of the patches in reactive script. That way you wouldn’t need to use the script/patch bridge.