#1
|
|||
|
|||
creating floating menu
hi,
i'm a newbie in this programming world.. i'm trying to create a half transparent floating menu in a round shape as below.. i have try it for a fortnight but still cant get a solution.. can anyone please guide me? thanks |
#2
|
|||
|
|||
Here is a small example that should provide you with enough to get started. You can use the left/right arrow keys to rotate the menu. Let me know if something is not clear.
Code:
import viz viz.go() import math QUADS = 8 #Number of menu quads RADIUS = 2 #Radius of menu ANGLE = (360.0 / QUADS) #Create overlay window for floating menu, with its own view/scene menuScene = viz.addScene() menuView = viz.addView() menuView.setScene(menuScene) menuWindow = viz.addWindow() menuWindow.setClearMask(viz.GL_DEPTH_BUFFER_BIT) menuWindow.setPosition(0,1) menuWindow.setSize(1,1) menuWindow.viewpoint(menuView) #Create root node for menu quads menu = viz.addGroup(scene = menuScene) menu.translate(0,1.8,5) #Create texture to apply to quads tex = viz.addTexture('ball.jpg') #Add each menu quad for x in xrange(QUADS): quad = viz.addTexQuad(parent=menu) angle = ANGLE * x x = math.sin( viz.radians(angle) ) * RADIUS z = math.cos( viz.radians(angle) ) * RADIUS quad.translate(x,0,z) quad.rotate(0,1,0,angle+180) quad.texture(tex) quad.alpha(0.7) #Rotate menu using arrow keys vizact.onkeydown(viz.KEY_LEFT,menu.addAction,vizact.spin(0,1,0,ANGLE*5,0.2)) vizact.onkeydown(viz.KEY_RIGHT,menu.addAction,vizact.spin(0,1,0,-ANGLE*5,0.2)) #Add some model to the normal scene viz.add('gallery.ive') |
#3
|
|||
|
|||
thanks
thanks..i'll let you know...
|
#4
|
|||
|
|||
hye...then how i'm going to declare each menu for each different screen?
i develop a different scene on differ .py file..then, i develop one menu.py, as a main scene , i wonder why i cant link to another .py file by following the scene tutorial?? |
#5
|
|||
|
|||
I'm sorry, I don't understand what you are asking. Can you explain it in more detail?
|
#6
|
|||
|
|||
(*^*)
hehe..sorry...
i had create a few different scene on different file..let's say scaffold.py and planetDemo.py. Then, i create a transparent menu as i ask before. then i tried to make the button function by click one of the button, and it can link to the scaffold.py file.but the problem is, it only function with .wrl but not .py?why does it happened? |
Thread Tools | |
Display Modes | Rate This Thread |
|
|