#Camera Pan Macro

1 messages ยท Page 1 of 1 (latest)

haughty pulsar
#

@echo elm

indigo jetty
#

ah this works too

haughty pulsar
#

Getting a jump on the thread this time!

indigo jetty
#

keep forgetting things like threads

echo elm
#

okay; would not other people gain on this knowlede in stead of hiding it ? but sure

haughty pulsar
#

all threads are archived when idle, not deleted

indigo jetty
#

not so much hiding as not giving people the idea that their question is interfering either.

haughty pulsar
#

Camera Pan Macro

indigo jetty
#

ok so canvas.animatePan({x: someplace, y: someplace, scale: zoomlvl, duration: timeInMilliSecs}) is a function that only works on the client firing it so i made a world script where it is used to pan from on place to the next...

echo elm
#

well thats perfect, I would need to find X and Y ; im sure thats easy enough; then its just about speed and time,

haughty pulsar
#

warpgate's crosshairs makes that an easy operation as well

indigo jetty
#
class FreezeFunctions {
    static async wait(ms) {
        return await new Promise(r => setTimeout(r, ms));
    }
    static #animateTo({location, duration=1000}={}) {
      return canvas.animatePan({
        x: location.x,
        y: location.y,
        scale: location.scale,
        duration: duration
      });
    }
    
    static animateVignette(start, end, duration, push=false) {
        if ( push ) {
            game.socket.emit(`world.${game.world.id}`, { action: "animateVignette", duration, start, end });
        }

        // Execute animation
        this.#animateTo({
            location: {x: start.x, y: start.y, scale: start.scale},
            duration: 0
        });
        this.#animateTo({
            location: {x: end.x, y: end.y, scale: end.scale},
            duration: duration
        });
    }
}
window.FreezeFunctions = FreezeFunctions;
// Handle the sockets here.
Hooks.on("ready", () => {
    
    game.socket.on(`world.${game.world.id}`, request => {
        console.log(request);
        if ( request.action === "animateVignette" ) {
            FreezeFunctions.animateVignette(request.start, request.end, request.duration);
        }
    });
})
``` which is basically this
#

the macro i used in the video used both this and warpgate

echo elm
#

that will take some testing out; Im im the middle of a map animation; but I will save this in a doc and return to it so not to have to many large tasks going.

indigo jetty
#
const {x: startX, y: startY} = await warpgate.crosshairs.show({label: "Start Point", interval: -1}, {});
const {x: endX, y: endY} = await warpgate.crosshairs.show({label: "End Point", interval: -1}, {});
const [startScale, endScale] = await warpgate.dialog([{type: "number", value: 1, label: "Start Zoom"}, {type: "number", value: 1, label: "End Zoom"}], 'Zoom','Ok');
FreezeFunctions.animateVignette({x: startX, y: startY, scale: startScale},{x: startX, y: startY, scale: startScale}, 5, true);
await FreezeFunctions.wait(1000);
FreezeFunctions.animateVignette({x: startX, y: startY, scale: startScale}, {x: endX, y: endY, scale: endScale}, 5000,true);
``` this then does the animation proper
echo elm
#

someone need to make this into a module

#

(also someone needs to find a module that manages all assets, im sorting 250 animated tokens, its insanity.

haughty pulsar
#

be the change you want to see ๐Ÿ™‚

echo elm
indigo jetty
#

this animate thingy, if you like it HB you can gobble it up into Warpgate if you want

echo elm
#

hb ?

indigo jetty
#

Honeybadger

echo elm
#

ah

haughty pulsar
#

but i'll keep it in mind as I tear it apart for v2 ๐Ÿ˜ˆ

echo elm
#

sequencer even is greek for me ; hence the "I shall not make module" ๐Ÿ˜›

indigo jetty
#

you can also preprogram the animation, the setup in this macro is more for on the fly heey this could use some introduction

#

but if you preplan it you can figure out all the locations you want to move to and setup a preprogrammed flow (wouldnt need warpgate then)

echo elm
#

yea I will use pings to manually show stuff

#

but for entering a large new map, made over 4 programs ; I would like to "showcase" it

#

specially if its a a lot to se.

indigo jetty
#

then it would more be like ```js
FreezeFunctions.animateVignette({x: 1000, y: 1000, scale: 1.2},{x: 1000, y: 1000, scale: 1.2}, 5, true);
await FreezeFunctions.wait(1000); // pause moment before the actual moving happens
FreezeFunctions.animateVignette({x: 1000, y: 1000, scale: 1.2}, {x: 750, y: 2000, scale: 1.4}, 5000,true);
await FreezeFunctions.wait(5000); //same wait time as the length of the panning.
FreezeFunctions.animateVignette({x: 750, y: 2000, scale: 1.4}, {x: 3000, y: 2000, scale: 0.9}, 5000,true);

#

actually i dont need to await the animateVignette... woops

#

but yeah that is all that is needed