mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
docs: Update
This commit is contained in:
parent
a36ea971b4
commit
6213ee66f7
@ -210,12 +210,12 @@ func drawGroundImage(screen *ebiten.Image, ground *ebiten.Image) {
|
|||||||
gw, _ := ground.Size()
|
gw, _ := ground.Size()
|
||||||
pw, ph := perspectiveGroundImage.Size()
|
pw, ph := perspectiveGroundImage.Size()
|
||||||
for j := 0; j < ph; j++ {
|
for j := 0; j < ph; j++ {
|
||||||
// z is in [1.5, 0.01]
|
// z is in [1, -1]
|
||||||
rate := float64(j) / float64(ph)
|
rate := float64(j) / float64(ph)
|
||||||
z := (1-rate)*1.5 + rate*0.01
|
z := (1-rate)*1 + rate*-1
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Translate(-float64(pw)/2, 0)
|
op.GeoM.Translate(-float64(pw)/2, 0)
|
||||||
op.GeoM.Scale(1/z, 4) // 4 is an arbitrary number not to make empty lines.
|
op.GeoM.Scale(1/z, 8) // 8 is an arbitrary number not to make empty lines.
|
||||||
op.GeoM.Translate(float64(pw)/2, float64(j)/z)
|
op.GeoM.Translate(float64(pw)/2, float64(j)/z)
|
||||||
|
|
||||||
src := image.Rect(0, j, gw, j+1)
|
src := image.Rect(0, j, gw, j+1)
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 24 KiB |
Loading…
Reference in New Issue
Block a user