#Camera Pan Macro
1 messages ยท Page 1 of 1 (latest)
ah this works too
Getting a jump on the thread this time!
keep forgetting things like threads
okay; would not other people gain on this knowlede in stead of hiding it ? but sure
all threads are archived when idle, not deleted
not so much hiding as not giving people the idea that their question is interfering either.
Camera Pan Macro
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...
well thats perfect, I would need to find X and Y ; im sure thats easy enough; then its just about speed and time,
warpgate's crosshairs makes that an easy operation as well
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
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.
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
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.
be the change you want to see ๐
im sorry; i will never have the time or capascity to code a module ๐
this animate thingy, if you like it HB you can gobble it up into Warpgate if you want
hb ?
Honeybadger
ah
maybe ๐ค feels almost like a sequencer addition though
but i'll keep it in mind as I tear it apart for v2 ๐
sequencer even is greek for me ; hence the "I shall not make module" ๐
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)
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.
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