-
Notifications
You must be signed in to change notification settings - Fork 10
G2D.RotoZoom
boxgaming edited this page May 12, 2023
·
3 revisions
Rotates and zooms an image.
G2D.Rotate centerX&, centerY&, img&, [xScale%], [yScale%], [rotation%]
- The centerX& and centerY& parameters indicate the location at which the center of the image will be rendered.
- The img& parameter is the id of the image to display.
- The optional text$ parameter will set the inner text content of the created element. For form input elements this will set the element's value attribute.
- The optional xScale% parameter defines the horizontal scale applied to the image. If not specified, this will default to 1.0.
- The optional yScale% parameter defines the horizontal scale applied to the image. If not specified, this will default to 1.0.
- The optional rotation% parameter defines the rotation (in degrees) applied to the image. If not specified, this will default to 0.
Example1: Load an image and continuously rotate, alternating between zooming in and zooming out.
Import G2D From "lib/graphics/2d.bas"
Dim testImg As Long
testImage = _LoadImage("https://raw.githubusercontent.com/boxgaming/qbjs/main/logo.png")
Dim rot, zoom, zf
zf = .05
Do
Cls
G2D.RotoZoom 320, 200, testImage, zoom, zoom, rot
_Limit 60
rot = rot + 2
zoom = zoom + zf
If zoom >=8 Then zf = -.05
If zoom <=.5 Then zf = .05
If rot >= 360 Then rot = 0
Loop