Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Text Overlay

luposian
Registered User
Quote
2023-03-27 02:40:55

I'm working on a game and I want text to temporarily (for 3-4 seconds) appear in front (in the middle) of the game screen, before fading away. How would I accomplish this?


Guest
Guest
Quote
2023-03-27 04:11:59

Couple different ways to do it. Here's an example of one way:

https://files.catbox.moe/0cfrp1....

Right now it fades in about 255 milliseconds. You can adjust the IntervalMS of the Every few seconds do something behavior to get it to 3 seconds. Pretty sure you can do a similar thing with just text and no image by adjusting the color instead of the alpha, but I have not tried it. Let us know if you need more help.


luposian
Registered User
Quote
2023-03-27 07:09:47

Ok, I changed the .PNG to a white background with black text (much larger, too). But I want JUST the black text to fade to the background color (white), not the entire PNG to fade to black. In other words, the white background would be transparent, showing everything behind it, so the black text is in front of the game image and all you see is the black text fade away to nothing.

I have an image that shows what I'm trying to achieve in my game, but I have no way of uploading images here, except by URL it seems.


luposian
Registered User
Quote
2023-03-27 07:37:15

YES! I finally got it (to fade the way I want it to)! With enough tinkering of the settings and everything, it finally worked! Now, I need to figure out how to incorporate it so that it is displayed over the existing game screen (assuming the white background is actually transparent), so that the black text fades away as desired.

Here's the .ccb, .exe, and .png:

https://files.catbox.moe/hem1v3....


Guest
Guest
Quote
2023-03-27 19:17:21

Here's another method of doing it:

https://files.catbox.moe/ezzkwn....

This one takes a bit more setup than the other method, but I think it does what you want. To smooth out the animation, you would need to do more images with smaller increments of transparency. I do 100%, 75%, 50%, 0% here.


luposian
Registered User
Quote
2023-03-27 23:51:20

The way I finally got it working is exactly the way I want it to happen. I just needed to tweak the settings a bit and change the .PNG. Unfortunately, I'm not sure what I did to make it work, but hopefully the white background is actually transparent. Can anyone provde a program example that will test to see whether my changes will work as desired? I'm assuming it would be two programs (the image display program and the transparent text program) working simultaneously, which I don't know how to incorporate, presently.

Guest wrote:
Here's another method of doing it:

https://files.catbox.moe/ezzkwn....

This one takes a bit more setup than the other method, but I think it does what you want. To smooth out the animation, you would need to do more images with smaller increments of transparency. I do 100%, 75%, 50%, 0% here.



Guest
Guest
Quote
2023-03-28 00:43:26

I'm not understanding your post. Are you talking about the background color of the scene or the image? You should be able to make a prefab of your 2D Overlay and test it out by importing it into the scene of your game. That way you can see if it's transparent or not. I mean if you have it already set up to how you like it then that would be the best thing to do. You can then make changes as needed.


luposian
Registered User
Quote
2023-03-28 01:41:57

Have you downloaded the archive I posted?

Run the EXE and see what it does. It is black text on a white background and the black text fades to white (or disappears). I need to know if that white background is actually transparent (if white is always transparent in a .PNG) or if it's a non-transparent (white) background with black text and would show up on anything it was placed on top of, which is NOT what I want.

What I'm trying to achieve is simply black text over the initial game screen, and everything shows through it. If you still don 't understand what I'm talking about, I'll zip up and upload an image of exactly what I'm trying to achieve.

You know how credits are shown on a TV show, during the beginning of the show or even sometimes at the end? That's the effect I'm trying to achieve. Simply text overlay, except the black text fades away.

Guest wrote:
I'm not understanding your post. Are you talking about the background color of the scene or the image? You should be able to make a prefab of your 2D Overlay and test it out by importing it into the scene of your game. That way you can see if it's transparent or not. I mean if you have it already set up to how you like it then that would be the best thing to do. You can then make changes as needed.



Guest
Guest
Quote
2023-03-28 02:24:25

If you are using the first code I sent you then yes the white background will appear over the screen like so:

🔎︎


It turns white over the black text before being deleted. That is why I sent you the second example that doesn't have the white background when it fades.


Guest
Guest
Quote
2023-03-28 02:29:29

Can't post two images in one post in this forum for some reason. See how it just fades to nothing in this pic:

🔎︎


This method uses an image sequence which then fades the text. It works the same in animation and/or movies. You just need to add some more images to the one I sent to smooth out the transition between opaque and transparent. If I'm still not understanding you, I am sure you can find a video on Youtube and post the link here with an example. I am assuming you just mean fade the text.


luposian
Registered User
Quote
2023-03-28 02:54:22

Ok, I found an example in Javascript, but when I tried running the game with the Javascript, it threw up an error. It was a different example, but similar.

https://codepen.io/ssddayz/pen/z...

Go here (above) to see the effect and the code. Question is, how could/would I incorporate this sequence of code (seems it's a combination of HTML, CSS, and JS) without producing an error? Does CopperCube 6.6 have limitations to what it can handle/accept in Javascript?


Guest
Guest
Quote
2023-03-28 04:13:14

Unfortunately I've not delved into the WebGL side of CC. Might or might not be possible. I do know CC uses an older version of JS, but I've forgotten which version. Believe it's ES5. Some other ways of doing it are making a video and playing it, animating a texture on a mesh, drawing a texture to the screen with an alpha channel. Depends on how much work you want to put into it. Maybe someone else knows.


just_in_case
Moderator
Quote
2023-03-28 04:32:01

@Luposian as @guest mentioned there are many ways of doing this. If you want you can skip using multiple images for the transition, by using a plane mesh with the image instead of overlay. Then you can use my shader to fade-in, and fade-out the plane mesh during runtime. In order to make the planemesh stays on the screen, you can child it to the camera.

Here is an example ccb file that fades the plane mesh, when the scene starts.
https://cdn.discordapp.com/attac...

There might be more methods for overlays as well. Hope this helps and is pretty easy to understand. you can change the speed and other various properties


luposian
Registered User
Quote
2023-03-28 05:01:32

THANK YOU! That is EXACTLY the effect I wanted! Now I just need to figure out how to incorporate the code! Thanks again!


just_in_case
Moderator
Quote
2023-03-28 11:00:40

@Luposian the above example uses an old version of the Fade object shader. Some recent versions also have webGL support.
I just updated the shader action again with a bug fix, the updated version can be downloaded from my website https://neophyte.cf/ccb_shader_f...

This update fixes the bug that was causing the transparency issue when used with transparent objects with the Fading-In option.

Regarding the implementation of the shader, it is fairly easy to use. You can execute the action at any event in your game, like on Key Pressed or on proximity, or at any interval.

in order to fade in, simply uncheck the fade-out option. Also, make sure your object is invisible when you are fading in so that the effect looks natural.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Intern?tional" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact