Reverse Viewport

Let Sim Innovations know about your Air Manager experience and let us know about your dream feature addition

Moderators: russ, Ralph

Message
Author
User avatar
Ralph
Posts: 7876
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Reverse Viewport

#21 Post by Ralph »

As I mentioned before, I think, you can do this with a move on the viewport. But that would only work for that one number. If you do this on a running text, then it would apply to all of numbers.

The alternative would be to use two running texts which are in sync and have different viewports.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Reverse Viewport

#22 Post by Keith Baxter »

The Artful Dodger wrote: Thu Aug 11, 2022 6:57 pm Keith:

Here is a simplified version of my problem. As the text goes down, I need for it not to show up in the blue box (rather, gradually disappear) but to continue moving down, and then gradually show up as it comes from beneath the blue box. All the while the blue box must remain transparent.
The version I gave you a video of had the numbers simply popping out and then popping back in once clear of the box. But I don't like that! For me, the hard part is keeping the blue box transparent so that i can put a number in it!
I wish you success and I thank you profusely!

Sparky
________________________________________________________________________________________________________________________
Sparky,

That can easily be achieved.

In the code below I created a background color for the "Block" canvas.
Then I created a "airspeed" canvas. This canvas should not have a background. Just your wheel text. I just added a arbitrary time text in there.

Code: Select all

Panel    = canvas_add(0, 0, 200, 100)
Block    = canvas_add(40, 40, 100, 50)
airspeed = canvas_add(40, 40, 100, 50)
--
Robo_50_H_HAR_VAC  = "font:roboto_regular.ttf; size:50px; color: #80FF80; halign:right; valign:center;"
--
LineNumber = 180
--
canvas_draw(Panel, function()
	_rect(3, 3, 195, 95)
	_stroke("green", 5)
end)
--
canvas_draw(Block, function()
	_rect(3, 3, 95, 45)
	_fill("red")
	_rect(3, 3, 95, 45)
	_stroke("blue", 5)
end)
--
canvas_draw(airspeed, function()
    _txt("14h30", Robo_50_H_HAR_VAC,100,25)
end)
--
function CreateMovingText(Index, Value)
	canvas_draw(Panel, function()
		_txt("Now is the time", Robo_50_H_HAR_VAC, 250, Index)
	end)
end
--
function Setup(LineNo)
print("LineNo", LineNo)
	CreateMovingText(LineNo, Value)
	LineNo = LineNo + 40
end
--
Count = 180
MyTimer = timer_start(250, 250, Setup)
print("Count = ", Count)

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: Reverse Viewport

#23 Post by The Artful Dodger »

Hi Keith:
No joy - the blue box isn't transparent! That's the problem I've been having. It needs to be transparent except for the lines around it! And of course the lettering but that changes all the time!

That's why I suggested to Ralph a "cutout" function that would surgically remove everything in its area below it.

Sorry, but thanks for trying!

Sparky

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Reverse Viewport

#24 Post by Keith Baxter »

The Artful Dodger wrote: Thu Aug 11, 2022 8:59 pm Hi Keith:
No joy - the blue box isn't transparent! That's the problem I've been having. It needs to be transparent except for the lines around it! And of course the lettering but that changes all the time!

That's why I suggested to Ralph a "cutout" function that would surgically remove everything in its area below it.

Sorry, but thanks for trying!

Sparky
Sparky,
Then at lease for me I do not understand.

All canvases are transparent.
Z order determines what shows on top.

Lets spend some time tomorrow on the discord and get you issue sorted.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: Reverse Viewport

#25 Post by The Artful Dodger »

Hi, Keith:
That (Discord) would be fine. However, a few minutes ago I had a thought that might work so I'll try that first thing before I trouble you further.
As to your question, I believe that all 'things' bordered by strokes are transparent; but you used one that wasn't transparent (to block the letters). I need to block the letters with something transparent - but that won't block the letters.
I'll let you know how my fresh idea works.
But, above all, thank you for volunteering your valuable time to help me. I appreciate it immensely.

Sparky

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Reverse Viewport

#26 Post by Keith Baxter »

Sparky,
Correct. Everything not drawn on a canvass is transparent.
Drawn items take present in Z order.
Canvases are also layered in Z order.
Items drawn within a canvas do no have to be within the canvas x,y,W,h.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Ralph
Posts: 7876
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Reverse Viewport

#27 Post by Ralph »

He doesn't want a blue box I guess, but a area in which the numbers don't show.

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: Reverse Viewport

#28 Post by The Artful Dodger »

Hi, Ralph:

Close. I need a transparent outlined blue box, under which the tape values pass, but, because I want to place the exact speed in the blue box, I need to hide the tape values which pass beneath it.
Long sentence - sorry!

Sparky

User avatar
Ralph
Posts: 7876
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Reverse Viewport

#29 Post by Ralph »

Do you have an image maybe?

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Reverse Viewport

#30 Post by Keith Baxter »

Ralph wrote: Fri Aug 12, 2022 5:17 am He doesn't want a blue box I guess, but a area in which the numbers don't show.
Ralph,

Well if he uses the code I posted then the "Now is the time" will not show in front of the red _fill(). They will be behind the red _fill() and the " wheel" numbers ("14h30") will be on top of the red _fill().

The _fill() could be any color.

I do not understand the issue. :?



Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply