07-10-2023, 04:12 PM
Here's all you were missing, @Dav:
Code: (Select All)
'===============
'PHOENIXTEST.BAS
'===============
'Are you using QB64 Phoenix, or the Bee?
'Run this code to see...
'Coded by Dav, JUL/2023
_Icon 'Single line added by Steve to add an icon which will become image handle #11
dh = _DesktopHeight * .85
Screen _NewImage(dh, dh, 32)
'safety test...
If _Width(-11) <> 32 Or _Height(-11) <> 32 Then End
bird& = _NewImage(dh, dh, 32): _Dest bird&
_PutImage (0, 0)-(dh, dh), -11: _Dest 0
row = 15: col = 15
xsize = _Width / row
ysize = _Height / col
rise = _Height
Dim Shared piece&(row * col), piecex(row * col), piecey(row * col)
Dim risespeed(row * col)
bc = 1
For c = 1 To col
For r = 1 To row
x1 = (r * xsize) - xsize: x2 = x1 + xsize
y1 = (c * ysize) - ysize: y2 = y1 + ysize
piecex(bc) = x1: piecey(bc) = y1
piece&(bc) = _NewImage(Abs(x2 - x1) + 1, Abs(y2 - y1) + 1, 32)
_PutImage (0, 0), bird&, piece&(bc), (x1, y1)-(x2, y2)
risespeed(bc) = Rnd * 2 + 1
bc = bc + 1
Next
Next
_Dest 0
Do
Line (0, 0)-(_Width, _Height), _RGBA(0, 0, 0, 55), BF
For t = 1 To row * col
tx = piecex(t): tx2 = piecex(t) + xsize
ty = piecey(t): ty2 = piecey(t) + ysize
RotoZoom3 piecex(t) + (xsize / 2), piecey(t) + (ysize / 2) + (rise * risespeed(t)), piece&(t), 1, 1, 0
rise = rise - .025
_Limit 3000
Next
_Display
Loop While rise > 0
For t = 1 To row * col
RotoZoom3 piecex(t) + (xsize / 2), piecey(t) + (ysize / 2), piece&(t), 1, 1, 0
_Display
Next
Sleep
Sub RotoZoom3 (X As Long, Y As Long, Image As Long, xScale As Single, yScale As Single, radianRotation As Single)
Dim px(3) As Single: Dim py(3) As Single ' simple arrays for x, y to hold the 4 corners of image
Dim W&, H&, sinr!, cosr!, i&, x2&, y2& ' variables for image manipulation
W& = _Width(Image&): H& = _Height(Image&)
px(0) = -W& / 2: py(0) = -H& / 2 'left top corner
px(1) = -W& / 2: py(1) = H& / 2 ' left bottom corner
px(2) = W& / 2: py(2) = H& / 2 ' right bottom
px(3) = W& / 2: py(3) = -H& / 2 ' right top
sinr! = Sin(-radianRotation): cosr! = Cos(-radianRotation) ' rotation helpers
For i& = 0 To 3 ' calc new point locations with rotation and zoom
x2& = xScale * (px(i&) * cosr! + sinr! * py(i&)) + X: y2& = yScale * (py(i&) * cosr! - px(i&) * sinr!) + Y
px(i&) = x2&: py(i&) = y2&
Next
_MapTriangle _Seamless(0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
_MapTriangle _Seamless(0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
End Sub