Forums

OverviewV-Play 2 Support (Qt 5)getpixel from mask › Reply To: getpixel from mask

OverviewV-Play 2 Support (Qt 5)getpixel from mask › Reply To: getpixel from mask
#11760

Bas

hi Günther,

 

i wanted to show an png image on a background by using slow fade and add some particles for some magical effect.

i ended up with the following solution: get the center of the content of the png and use a circular random spread.

                angle=Math.random()*PI2;
                item.x = parImg.x + parImg.px + ( Math.random() * parImg.pradiusX )*Math.cos(angle) - (item.width>>1);
                item.y = parImg.y + parImg.py + ( Math.random() * parImg.pradiusY )*Math.sin(angle) - (item.height>>1);

 

using the canvas could have been an option :)

 

thanx!

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