Open KenGitsIt opened 1 year ago
Thank you for this wonderful module! My only quibble is that I personally find the animation speed to fast; I think a slower speed adds to the spooky atmosphere I want to convey in the game I'm running. I've been able to change the speed in the code, but then I must lock it down from future updates.
If you could create a configurable setting to replace the hardcoded animation durations of 1000, that would be wonderful!
Or perhaps a scaling factor to apply to all durations, since not all hardcoded durations are 1000.
I think there is delay option somewhere.
The delay option doesn't slow down the movement of the planchette. It only creates a pause between arriving at one letter and starting the move towards the next.
In the relevant code:
let sequence = new Sequence()
.animation()
.on(ouija_token)
.duration(1000)
.moveTowards(xyPosition, {
ease: "easeInOutCubic"
})
.rotateTowards(ouija_map.bottomLocation, {
duration: 1000,
ease: "easeInOutCubic"
})
.waitUntilFinished()
.sound(soundToPlay)
.volume(sound_volume)
.wait(200)
.wait(extraTimeMin, extraTimeMax);
The part I would like to see configurable is the duration(1000), so that it can take more than one second to move across the board. For my own game, I have changed the hardcoding to 5000, and also made corresponding adjustments to the jiggle animation.
I suppose another approach would be to configure a velocity, rather than a duration. That way, the planchette would more realistically take less time to travel to an adjacent letter than to a letter all the way across the board. In that case, the duration would need to be computed based on the configured velocity and the distance between the initial and final positions.
Ok. I'll try
I suppose another approach would be to configure a velocity, rather than a duration. That way, the planchette would more realistically take less time to travel to an adjacent letter than to a letter all the way across the board. In that case, the duration would need to be computed based on the configured velocity and the distance between the initial and final positions.
Can you share your changes?
I don't know how to fix jiggle now.
For what it's worth:
For my changes to the hardcoding, I did the same as what you show there for the movement. I didn't change the duration on the rotation, still allowing the rotation part of the animation to complete in 1 second.
I also changed the jiggle animation, so that it moves at a pace that I like better:
static async jiggle(letter) {
const xyPosition = this.sceneMap(letter);
let newX = xyPosition.x;
newX -= 15;
let newY = xyPosition.y;
newY -= 25;
let sequence = new Sequence()
.animation()
.on(ouija_token)
.duration(2500)
.moveTowards({ x: newX, y: newY}, {
ease: "easeInOutCubic"
})
.waitUntilFinished().wait(50);
await sequence.play();
let sequence2 = new Sequence()
.animation()
.on(ouija_token)
.duration(2500)
.moveTowards(xyPosition, {
ease: "easeInOutCubic"
})
.waitUntilFinished().wait(200);
await sequence2.play();
}
I haven't tried implementing the velocity approach that I described, although I think that would be superior. If you are interested in doing that, I'll be glad to assist.
My jiggle change also included a change to sendMessage, so that it wouldn't do the usual animation:
static async sendMessage(text, moveType) {
let message = text.split('');
let previousLetter; // jiggle
for (let index = 0; index < message.length; index++) {
const letter = message[index];
if (letter === previousLetter) {
await this.jiggle(letter);
}
else { const output = await this.sendToPosition(letter, moveType); }
previousLetter = letter;
} // END FOR
}
https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Animations#move-speed
I couldn't see improvement on moveSpeed
I don't know the Sequencer API. But velocity could easily be done using logic like this: (This is pseudocode, not proper Javascript.)
let distance = sqrt((oldpos.x - newpos.x)^2 + (oldpos.y - newpos.y)^2);
let duration = distance / speed;
I will only use sequencer API. It's very well done. I can't match that.
The way to do is with https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Animations#move-speed
I pushed an update. Is this close this issue?
It works great for me! But for others, I would recommend having the jiggle function use a duration of moveSpeed / 2
rather than hardcoding it to 2500. That way, it will always take the same amount of time to repeat a letter as to move to a different one.
Thank you for this wonderful module! My only quibble is that I personally find the animation speed to fast; I think a slower speed adds to the spooky atmosphere I want to convey in the game I'm running. I've been able to change the speed in the code, but then I must lock it down from future updates.
If you could create a configurable setting to replace the hardcoded animation durations of 1000, that would be wonderful!
Or perhaps a scaling factor to apply to all durations, since not all hardcoded durations are 1000.