Trapezoid.qml Example File

 import QtQuick 2.0
 import Felgo 3.0

 EntityBase {
   id: trapezoid

   width: 80
   height: 50

   transformOrigin: Item.TopLeft

   // if width is 100 and this is 80, from each side 10 are removed on the top
   property real upperSideWidth: width - 20

   // this is an internal property and cant be set from outside
   property real __deltaFromEachSide: (width-upperSideWidth)/2

   PolygonCollider {
     sleepingAllowed: false
     density: 0.001
     friction: 0.3
     restitution: 0.5
     vertices: [
       Qt.point(0, 0),
       Qt.point(__deltaFromEachSide, trapezoid.height),
       Qt.point(width-__deltaFromEachSide, trapezoid.height),
       Qt.point(trapezoid.width, 0)

   // this is the full width & height of the trapezoid, also including the cut part
   Rectangle {
     anchors.fill: parent
     color: "blue"
     opacity: 0.5

   // this is the inner part of the trapezoid - at the moment no triangle can be painted
   Rectangle {
     x: __deltaFromEachSide
     width: upperSideWidth
     height: parent.height
     color: "green"

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support