套用上spine發現有點透明的感覺,本來是以為有用了什麼濾鏡,後來想一想去檢查assetpack,才發現原來是assetpack的問題,要在資料夾上面加個 {nc} 讓它不要被壓縮到。
然後抓這個repo下來start,就可以看範例了,也可以自己新增。
套用上spine發現有點透明的感覺,本來是以為有用了什麼濾鏡,後來想一想去檢查assetpack,才發現原來是assetpack的問題,要在資料夾上面加個 {nc} 讓它不要被壓縮到。
然後抓這個repo下來start,就可以看範例了,也可以自己新增。
要刪除中間的影片又想要影片沒有斷層,按住中間的影片 Alt + Backspace
也可以直接在Timeline上縮短單一clip的長度,要按住Ctrl才不會留下gap
這邊的紅字就是Event
To read:
XState v5 is here | Stately
Here’s a simple JavaScript example to calculate the proportional height of an image when you set a fixed width:
function calculateProportionalHeight(originalWidth, originalHeight, newWidth) {
const newHeight = (originalHeight * newWidth) / originalWidth;
return newHeight;
}
// Example usage:
const originalWidth = 800;
const originalHeight = 600;
const newWidth = 400;
const newHeight = calculateProportionalHeight(originalWidth, originalHeight, newWidth);
console.log(`The proportional height for the new width is: ${newHeight}px`);
calculateProportionalHeight
function takes the original width, original height, and the new width as arguments.In this example, if the original dimensions are 800×600, and you set a new width of 400, the function will calculate the new height that maintains the image’s aspect ratio.
https://chatgpt.com/share/6708fb61-3764-8001-b612-cc70253e169e
The goal is to make the sprite fit the width of the screen while keeping its proportions (aspect ratio) the same. To do this, we use the formula:
this.scale.x = this.app.screen.width / this.texture.width;
and
this.scale.y = this.scale.x;
Let’s break down the formula into simpler parts:
this.app.screen.width
: This is the width of your app’s screen (the space in which your sprite should fit).this.texture.width
: This is the original width of your sprite’s image.When you divide this.app.screen.width
by this.texture.width
, you are calculating how much bigger or smaller the sprite should be to fit the screen.
The principle behind this is called proportional scaling. The idea is that if you want to change the size of an object while keeping its shape the same, you need to multiply both the width and height by the same number.
Imagine you have a picture that is 200 pixels wide and your screen is 800 pixels wide. To make the picture fit the screen:
800 / 200 = 4
.That means the scale factor is 4
, so you set:
this.scale.x = 4;
this.scale.y = 4;
This makes both the width and the height of the picture 4 times bigger, keeping its original shape.
this.scale.x
and this.scale.y
?Using this.scale.x
and this.scale.y
ensures that your sprite grows or shrinks evenly in all directions, so it doesn’t look stretched or squished.
Here’s a step-by-step summary of what happens:
this.app.screen.width / this.texture.width
this.scale.x
to this value so the width fits the screen.this.scale.y
to the same value to maintain the aspect ratio.Think of a photo that you want to print in a larger size. If you want to make the photo twice as wide, you also need to make it twice as tall to keep it looking right. If you don’t do this, the picture might end up looking stretched or distorted.
I hope this breakdown helps you understand the math and logic behind scaling in PixiJS! If you have any more questions, feel free to ask! 😊
原來是打包後的檔案,系統刪不掉?
要用sudo再刪一次,就可以成功打包惹
單純rm -rf 不行