Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How to change and image transparency  (Read 341 times)
0 Members and 1 Guest are viewing this topic.
Offline Norakomi
« Posted 2014-05-29 16:11:06 »

Hi,

I wanna create a splashscreen/logoscreen when i start my game.
And i want to be able to change the transparency values of my logo so it fades into focus starting at being invisible (fully transpatrent?) to visible (no transparency) over a certain period of time (i'm thinking to just use a counter?).

the way i pain my logo onscreen now is this:
1  
2  
3  
g.setColor(Color.white);
g.fillRect(0, 0, 480, 800);
g.drawImage(splashscreenlogo, 0, getHeight() / 3, this);


So I'probably wanna have a for loop run over my g.drawImage function, and set the transparency values within this loop,but i have no idea how i set the transparency values of my image.

Can anyone help?

Norakomi Retro Games Projects at: http://norakomi.blogspot.nl/
Downloadable Android beta version PacManbow at: https://www.dropbox.com/s/fd96c3sl3nvowsn/pacmanbow-android.apk?dl=0
Offline Slyth2727
« Reply #1 - Posted 2014-05-29 16:46:33 »

This link should show you all you need to  know Smiley
Next time try and fire up old google, that was the first thing that popped up when I searched "java2D transparency".

http://www.informit.com/articles/article.aspx?p=26349&seqNum=5

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline Norakomi
« Reply #2 - Posted 2014-05-29 17:48:48 »

This is what i was looking for!

TY

yeah i searched around, on different sites (google included), but couldnt find what i was looking for...

Norakomi Retro Games Projects at: http://norakomi.blogspot.nl/
Downloadable Android beta version PacManbow at: https://www.dropbox.com/s/fd96c3sl3nvowsn/pacmanbow-android.apk?dl=0
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline philfrei
« Reply #3 - Posted 2014-05-29 18:45:48 »

Slyth2727's link looks good.

Here is where I first learned how to do this, from a JGO post by StumpyStrust:
http://www.java-gaming.org/topics/java2d-clearing-up-the-air/27506/msg/246444/view.html#msg246444

There are a bunch of nifty suggestions there, including resizing/scaling, in addition to the info about changing transparency levels.

"It's after the end of the world! Don't you know that yet?"
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (36 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!