Hi, I am exporting a spine file to json and load it via the spine-player
the skeleton is completely square (1200,1200) and I can see that the export functionality of the spine editor generate square png for example

but the spine player is for some reason creating a canvas with a different aspect ratio, with a greater width that expand on the size. and I see it is updated in real time so this is calaculated by the spine player and not something I can easily change

This seems a like a bug. what drive the canvas size ?

Note I am also using the following

viewport: {
   x: -600,
   y: -600,
   width: 1200,
   height: 1200,
   padLeft: "0%",
   padRight: "0%",
   padTop: "0%",
   padBottom: "0%",
  debugRender: true
},
Related Discussions
...

The canvas size in the Spine Player is determined by the HTML element it renders to, which is a canvas. The size and position of this canvas are set like any other HTML element. By default, the Spine Player scales the skeleton to fit within the player bounds, which can result in empty space around the skeleton if the aspect ratio of the canvas does not match the aspect ratio of the skeleton. You can specify the viewport size and trim any animation outside the size to control how the skeleton is displayed. This behavior is not a bug but rather how the Spine Player is designed to handle different aspect ratios and scaling.

  • wighawag ответили на это сообщение.

    Spinebot

    hmm, I set the size, but it still do not make it sqaure.

    I get that it is a html element, but it is created by spine player and I can see it keep updating the canvas.width value as if I change it to whatever it get repalced.

    (note here I am talking about the canvas size, not the css size of it)

    My question is how can I make sure spine player keep the ratio that is in the skeleton and not add padding

    • wighawag ответили на это сообщение.

      wighawag

      Ha never mind, it was indeed my mistake. copied paste form the example and for some reason did not realised the style="max-width:640px; aspect-ratio: 16/9" was set by me not by the spine-player

      Changing that allow me to have a square spine player