WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-05-2018, 08:50 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Can you post example code that reproduces the issue?
Reply With Quote
  #2  
Old 09-06-2018, 04:23 AM
peterparker peterparker is offline
Member
 
Join Date: Aug 2018
Posts: 12
Code:
import viz, vizshape, vizact
import random


# run script
viz.go()
viz.setMultiSample(4)


# create world
#world = viz.add('spot_rotation_resources/circle_grass_lukas2.osgb')

world = vizshape.addCylinder(.01,50)
#tex = viz.addTexture('GRASS.JPG')
#world.texture(tex)
world.color(viz.GREEN)

light = viz.addLight()
light.setEuler(0,45,0)


# create spot
spot_elevation = .05
spot_height = 2.5
spot_nslices = 1	#originally 100
spot_slice_height = spot_height / spot_nslices
alpha_start = 0.5
alpha_end = 0.0
alpha_step = (alpha_end - alpha_start)/spot_nslices

spot = []

for a in range(spot_nslices):
	cyl = vizshape.addCylinder(height=spot_slice_height, radius=0.30, color=viz.YELLOW, top=None)
	cyl.alpha( alpha_start + a*alpha_step )
	spot_yPos = spot_slice_height/2 + spot_elevation + a*spot_slice_height
	cyl.setPosition([0,spot_yPos,10])
	spot.append(cyl)


# rotate ground
def random_rotate(object_to_rotate, duration):

        rotate_val = random.randint(1, 360)

        spinto = vizact.spinTo(euler=(rotate_val, 0, 0), time=0, mode=viz.REL_GLOBAL)
        fadeout = vizact.fadeTo(0, time=duration)
        fadein = vizact.fadeTo(1, time=duration)

        rotate_action = vizact.sequence(fadeout, spinto, fadein)
        object_to_rotate.addAction(rotate_action)

vizact.onkeydown('r', random_rotate, world, 1)

Also works with
Code:
vizact.onkeydown('s', world.alpha, .9)
instead of the fading action.

Last edited by peterparker; 09-06-2018 at 04:29 AM.
Reply With Quote
Reply

Tags
cylinder, gradient, transparency


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
maintaining transparency in a model while fading in krimble Vizard 3 08-17-2017 06:10 AM
transparency control hankiwan Vizard 1 02-14-2012 07:02 AM
How to vary the transparency of the scene whj Vizard 2 04-04-2010 08:16 PM
How to vary the transparency of part of the scene whj Vizard 0 04-02-2010 02:32 PM
Quicktime movie with transparency channel aaThomas Vizard 7 11-12-2007 09:54 AM


All times are GMT -7. The time now is 11:15 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC