Forums

OverviewV-Play 1 SupportLineItem opacity › Reply To: LineItem opacity

OverviewV-Play 1 SupportLineItem opacity › Reply To: LineItem opacity
#5940

Alex
V-Play Team

Hi Heini,

i created 2 examples with which i just checked your issue, both work for me. Please try them too and let me know if there are also any issues.

1. Move slider to change the opacity of the LineItem

import VPlay 1.0
import QtQuick 1.1
GameWindow {
  id: window
  width: 960
  height: 640
  Scene {
    id: mainScene
    width: 480
    height: 320

    Column {
      anchors.right: parent.right
      width: 200
      Text {
        text: "opacity "+slider.value
        color: "white"
      }
      Slider {
        id: slider
        width: parent.width
        minimumValue: 0
        maximumValue: 1
        defaultValue: 1
        stepSize: 0.1
      }
    }

    LineItem {
      opacity: slider.value
      points: [
        {"x":100, "y":100},
        {"x":300, "y":300}
      ]
    }
  }
}

 

2. The LineItem fades in and out every second

import VPlay 1.0
import QtQuick 1.1

GameWindow {
  id: window
  width: 960
  height: 640
  Scene {
    id: mainScene
    width: 480
    height: 320

    LineItem {
      id: lineItem
      points: [
        {"x":100, "y":100},
        {"x":300, "y":300}
      ]
      Behavior on opacity {
        NumberAnimation{duration: 500}
      }
    }

    Timer {
      interval: 1000
      running: true
      repeat: true
      onTriggered: {
        lineItem.opacity = lineItem.opacity === 0 ? 1 : 0
      }
    }
  }
}

Cheers,
Alex

 

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
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support