RotateShapeXY
RotateShapeXY ShapeIndex, Angle#, ScaleX#, ScaleY#
 
Parameters:

    ShapeIndex = The Index of the shape you wish to rotate
    Angle# = The angle to rotate this shape
    ScaleX# = The amount to scale this shape in the X axis
    ScaleY# = The amount to scale this shape in the Y axis
Returns: NONE
 

     RotateShapeXY dynamically rotates and scales a shapes vertex and is the sister command to RotateShape. The only difference being that this version allows the vertex to be scale on X and Y axis independently.

      Shapes actually have two copies of the vertex buffers inside them, the 'original' and a 'rotated' versions. So rotating the shape doesn't permanently change the shapes original vertex, rather the transformed originals vertex are stored in the rotated buffer for display and collision.




FACTS:


     * When a shape is rotated, the rotation doesn't damage the shapes original vertex.



Mini Tutorial:


      This example creates a convex shape, then rotates and draws it.


  
; Limit the frame rate to 60 or less
  SetFPS 60
  
; Create a Convex MySHape, of size 50, with 6 edges
  MySHape =NewConvexShape(50,6)
  
  
; Start of Do/loop
  Do
     
   ; Clear the Screen
     Cls RGB(0,0,0)
     
   ; Rotate MyShape
     RotateShape MyShape,Angle#,1+Cos(angle#)
     
   ; Draw the Filled shape
     CenterText 100,20,"Rotating Shape"
     DrawShape MyShape,100,100,2
     
   ; Calc the X & Y  Scale
     scalex#=1+Cos(angle#)
     Scaley#=2+Sin(angle#)
     
   ; Rotate MyShape
     RotateShapeXY MyShape,Angle#,ScaleX#,Scaley#
     
     
   ; Draw the Filled shape
     CenterText 300,20,"Rotating Shape"
     DrawShape MyShape,300,100,2
     
     
   ; Bump and wrap the rotation angle
     Angle#=WrapAngle(angle#,1)
     
   ; Display the screen and wait for a key press
     Sync
  Loop
  



      This example outputs,






 
Related Info: DrawShape | RefreshShape | RotateShape | ScaleShape | ScaleShapeXY | ShiftShape :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com