fantasycalendar / FoundryVTT-Sequencer

This module implements a basic pipeline that can be used for managing the flow of a set of functions, effects, sounds, and macros.
Other
47 stars 25 forks source link

[BUG] - Adding a text to sprite with "rotateTowards" changes the anchor point #268

Open Codas opened 3 months ago

Codas commented 3 months ago

Adding a text to an effect that is positioned with "rotateTowards" sets the anchor at an unexpected location.

Every effect is positioned at 1500x1000, with 200 units y-offset for each following effect. In the following screenshot, the first entry is just positioned using rotateTowards to the right, second is the same but with a text added, third is as before but using rotate(0) instead of rotateTowards.

rotateTowards with text behavior

Effects 1 and 3 are positioned correctly, whereas effect 2 I think should look just like 1 but with a text added and centered at the effects location, like in the third screenshot.

Code used to create these effects:

const textStyle = { fill: "#ffffff", strokeThickness: 5 }

new Sequence()
  .effect()
  .file("jb2a.energy_beam.normal.bluepink.03")
  .atLocation({ x: 1500, y: 1000 })
  .rotateTowards({ x: 2000, y: 1000 })
  .play()

new Sequence()
  .effect()
  .file("jb2a.energy_beam.normal.bluepink.03")
  .atLocation({ x: 1500, y: 1200 })
  .rotateTowards({ x: 2000, y: 1200 })
  .text("with text", textStyle)
  .play()

new Sequence()
  .effect()
  .file("jb2a.energy_beam.normal.bluepink.03")
  .atLocation({ x: 1500, y: 1400 })
  .rotate(0)
  .text("with text and rotate(0)", textStyle)
  .play()