Canvas Textures

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Message
Author
JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Canvas Textures

#11 Post by JackZ »

Yes, the canvas feature has been a huge improvement introduced in AM v3.x (remember my lame attempt at an interim graphic library anyone?) thanks Corjan!

It is not a real war TBH, As said previously, the key here is « the right tool for the right task ».

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

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

Re: Canvas Textures

#12 Post by Keith Baxter »

Jacques,

Some nice work bud.

@Corjan Jacques and I have an understanding and all this is for the benefit of all peeps to get an Idea of what can and cannot be done on each approach. Both approaches have their pro's and cons. This will give peeps an idea of when to use what approach. Yes we are spoiled and can mix and match.

Just have to get this one in :mrgreen: Is 3D on the radar anytime soon?

I am sure both of us would love that.

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
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Canvas Textures

#13 Post by Keith Baxter »

Hi

:D :D :D
I have been thinking about switch shadows and a hack towards 3D .

Having done some work regarding maps and the manipulation of data this is possible. Expensive though.

@Corjan I do not want to spend weeks on this if there is something coming soon.

I have something in mind and will work on it.

I suppose that the graphic data from the sim frame needs to be had some how? Is that data available?

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
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Canvas Textures

#14 Post by Keith Baxter »

Peeps i am inquisitive, and <Canvas Textures> is not far of the challenge to create shadows and graphic movement.

I can manipulate a polygon within canvas_draw() to simulate a switch and a fixed shadow. Even stretch or compress.

I am just thinking here @Corjan , From an automation point of view. A camera function.

This camera function could be... Manipulation of the node.

I think this could work.

The node is added to the... camera_id=camera_add(node_id..)

effects would need to be along the lines of turnstile, roller etc....

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
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Canvas Textures

#15 Post by Keith Baxter »

Hi,

Here you go @JackZ Something you will love.




Keith

Code: Select all

my_canvas=canvas_add(0,0,500,200)
   canvas_draw(my_canvas, function()
     _rect(0,0,500,200)
     _fill("yellow")
     _circle(15,15,15)
     _fill("red")  
     _rect(0,80,350,80)
     _fill_img("switch_small_down.png",0,80,350,80)
   end)

val1=10
val2=5
function dial_callback(dir)
  val1=val1+(dir*20)
  val2=val2-(dir*10)
   canvas_draw(my_canvas, function()
     _rect(0,0,500,200)
     _fill("yellow")
     _circle(15,15,15)
     _fill("red")   
     _rect(0+val2,80,350+val1,80)
     _fill_img("switch_small_down.png",0+val2,80,350+val1,80)
   end)
end

my_dial=dial_add(nil,0,0,30,30,dial_callback)
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
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Canvas Textures

#16 Post by Keith Baxter »

Hi,

It might be that this concept could be used to create a joy stick. ??


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
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Canvas Textures

#17 Post by jph »

Hi Keith,
What about a different approach ?. If the switch visible area is a 'view window', then could you not use a strip image with a long series of fixed progressive switch images for the movement and then progress that 'strip' image behind the window ?. Done at the appropriate speed it would give you a progressive movement view of the switch change. - or a rotary disk - whatever.
It is the same idea as the old 'flipbook animation' used more than 150 years ago (some historical example go back more than 600 years) only that the changing images would be on a strip or circular continuous png that was moved along - or 'around' behind the view window.

https://en.wikipedia.org/wiki/Flip_book

try a quick search on flipbook animation on YT for examples. It would be the same principle with a strip of images that were stepped along in a way that would be one frame per step.
I believe there are even on line tools that can create progressions --

Joe.
Joe. CISSP, MSc.

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Canvas Textures

#18 Post by Sling »

Nice one Keith. Interesting concept. Is the switch a png added to the canvas or is it all pure vector graphics.

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

Re: Canvas Textures

#19 Post by Keith Baxter »

Sling wrote: Tue Aug 17, 2021 8:02 am Nice one Keith. Interesting concept. Is the switch a png added to the canvas or is it all pure vector graphics.
Yes Tony,

It is a .png in a canvas. One could also manipulate a vector graphic in the same way.

@jph Thanks for the heads up. I will take a look.

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 

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Canvas Textures

#20 Post by JackZ »

Nice find @Keith Baxter !
I doubt it would be really useful for a switch or a joystick where the transition from one position to another is almost instant due to the spring loaded nature of the switch, so the good old image swap is still my favorite, but I sure could find usages for animation of this, maybe for shadows.

Will have to experiment

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

Post Reply