本文整理汇总了Python中vizact.fadeTo函数的典型用法代码示例。如果您正苦于以下问题:Python fadeTo函数的具体用法?Python fadeTo怎么用?Python fadeTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fadeTo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SackAnim
def SackAnim (self, sid): #sid is the sack id: {1R, 2R, 1L, or 2L}
self._usedSackCounter += 1
sack = self.components['sack'+sid]
self.sack_path = self.sackItem.getChild('path'+sid).copy()
self.sack_path.setParent(self.factory) #prevent from appearing in MainWindow
sack.setParent(self.sack_path, node='path'+sid)
self.sack_path.setAnimationSpeed(1)
sack.addAction(vizact.waittime(3)) #wait for sack animation
endAnimSignal = vizact.signal()
trig = endAnimSignal.trigger
hide = vizact.method.visible(0)
sack.addAction(vizact.parallel(hide, trig))
self.sackPour.addAction(endAnimSignal.wait) # wait for animation before pouring starts
self.sackPour.addAction(vizact.method.alpha(1, node='sack_bent'))
self.sackPour.addAction(vizact.spinTo(euler=[0,-45,0], time=.75, interpolate=vizact.easeInStrong))
self.sackPour.addAction(vizact.fadeTo(1, begin=0, time=.5, node='olive_flow'))
loadSignal = vizact.signal()
self.sackPour.addAction(loadSignal.trigger)
self.sackPour.addAction(vizact.waittime(5))
self.sackPour.addAction(vizact.fadeTo(0, time=.5))
self.sackPour.addAction(vizact.method.setEuler([0,0,0])) # put it back standing
self.mixedPulp.addAction(loadSignal.wait) # wait for olive pouring before pulp appears
self.mixedPulp.addAction(vizact.method.visible(1))
#self.mixedPulp.addAction(vizact.fadeTo(1, begin=0, time=1, node='olives'))
move = vizact.moveTo([0, 0, 0], time=5)
resize = vizact.sizeTo([1, 1, 1], time=5, interpolate=vizact.easeIn)
self.mixedPulp.addAction(vizact.parallel(move, resize))
self.sack_path.addAction(loadSignal.wait)
self.sack_path.addAction(vizact.method.setAnimationSpeed(-100)) #put sack back
示例2: StartSeparation
def StartSeparation (self, start):
self.oil.addAction(vizact.fadeTo(start, time=.5))
self.water.addAction(vizact.fadeTo(start, time=.5))
if start == 1:
pitcher = self.components['pitcher'+self.LR]
oilSurf = pitcher.getChild('oilSurface')
oilSurf.addAction(vizact.moveTo([0,.5,0], time=10))
示例3: CycleAlertsTask
def CycleAlertsTask (self):
self._cycler = None #the next item in the list to display (starts with last)
fade_out = vizact.fadeTo(0, 1, time=0.5, interpolate=vizact.easeOutStrong)
fade_in = vizact.fadeTo(1, 0, time=0.5, interpolate=vizact.easeOutStrong)
#set all alerts on map to 100% opaque so that they don't stay semi-transparent
for i in [a for m, a in self._alerts.iteritems() if m != 'info']:
a.alpha(1)
while True:
data = yield viztask.waitDirector(self.GetNextMessage)
nextKey = data.returnValue
if nextKey == 'info': #not verified anymore because info not in _messages
self._infoPanel.setText(self._messages[nextKey])
else:
self.DisplayAlert(self._messages[nextKey])
if nextKey != 'info':
alertObj = self._alerts[nextKey]
yield viztask.addAction(alertObj, fade_out)
yield viztask.addAction(alertObj, fade_in)
yield viztask.addAction(alertObj, fade_out)
yield viztask.addAction(alertObj, fade_in)
yield viztask.addAction(alertObj, fade_out)
yield viztask.addAction(alertObj, fade_in)
yield viztask.addAction(alertObj, fade_out)
yield viztask.addAction(alertObj, fade_in)
else:
yield viztask.waitTime(5)
示例4: fadeAndAppear
def fadeAndAppear():
ball = viz.add('soccerball.ive')
ball.setPosition(2,2,0)
yield viztask.addAction( ball, vizact.fadeTo(0,time=2) )
print 'done fading'
yield viztask.addAction( ball, vizact.fadeTo(1,time=2) )
print 'done appearing'
示例5: fadeAndAppear
def fadeAndAppear():
global screen, fadeInAndOut, selector, phoneEvent
yield viztask.waitTime(3)
yield screen.playsound('resources/audio/vibrate.wav', viz.LOOP)
selector.enable()
fadeInAndOut = vizact.sequence([vizact.fadeTo(0, time=0.5), vizact.fadeTo(1,time=0.5)], viz.PERPETUAL)
phoneEvent = vizact.onmousedown(viz.MOUSEBUTTON_LEFT, selectPhone)
screen.addAction( fadeInAndOut )
示例6: CoalAction
def CoalAction(self, act): #act=1->load, 2->light, 3->waste
coalFurnace = self.components['coalfurnace']
if act == 1: #fade in the coals
coalFurnace.addAction(vizact.method.visible(1))
coalFurnace.addAction(vizact.fadeTo(1, begin=0, time=1))
elif act == 2: #turn coals red and light fire
self.PlayAudio('boiler_light', coalFurnace, viz.PLAY)
fireSignal = vizact.signal()
coalFurnace.addAction(vizact.fadeTo(viz.RED, time=1))
coalFurnace.addAction(fireSignal.trigger)
cPos = coalFurnace.getPosition()
coalFurnace.addAction(vizact.moveTo([cPos[0],cPos[1],cPos[2]+.1],time=.5))
self.fire.addAction(fireSignal.wait)
self.fire.addAction(vizact.method.visible(1))
self.fire.addAction(vizact.fadeTo(0.75, time=1))
self.fire.addAction(vizact.waittime(4))
self.fire.addAction(vizact.call(self.PlayAudio, 'boiler_furnace'))
elif act == 3: #fade out the coals and fire
self.AdjustAudio(.5)
coalFurnace.addAction(vizact.fadeTo(0.25, time=.5))
self.fire.addAction(vizact.fadeTo(0.25, time=.5))
elif act == 4: #light up the coals and fire again
self.AdjustAudio(1)
coalFurnace.addAction(vizact.fadeTo(1, time=.5))
self.fire.addAction(vizact.fadeTo(.75, time=.5))
elif act == 5: #fade out the coals and fire completely
self.AdjustAudio(0)
self.AdjustAudio(1)
coalFurnace.addAction(vizact.fadeTo(0, time=.5))
coalFurnace.addAction(vizact.method.setPosition([0,0,0]))
coalFurnace.addAction(vizact.method.color(viz.GRAY))
coalFurnace.addAction(vizact.method.visible(0))
self.fire.addAction(vizact.fadeTo(0, time=.5))
self.fire.addAction(vizact.method.visible(0))
示例7: fadeAllZone1
def fadeAllZone1():
globals_oa.terrainZone1.alpha(0)
globals_oa.terrainZone1.visible(viz.ON)
worldvizcode.stopEffects()
viz.fog(0)
fadeInZone1 = vizact.fadeTo(1, time=2)
yield globals_oa.terrainZone1.addAction(fadeInZone1)
示例8: EnablePlayer1ForMultiInput
def EnablePlayer1ForMultiInput (self, secInput):
if self._player == 1 and len(self.PLAYERS) == 1 and self._collabAction == '':
self._collabAction = ', '+secInput #add second action for 1P conditions
self._collabIcon.texture(self._collabTextures[0])
self._collabIcon.addAction(vizact.fadeTo(0, begin=1, time=5, interpolate=vizact.easeInCircular))
self._collabTimer = vizact.ontimer2(5, 1, self.DisablePlayer1ForMultiInput)
print "PLAYER1: Preparing to execute multi-input action!"
示例9: H2CO3formation
def H2CO3formation():
global bigCO2, bigH2O, h2co3molecule, co2Path, lowPolyMole, highPolyMole, h2co3FormationTriggered
h2co3FormationTriggered = True
viz.sendEvent(globals_oa.H2CO3_COMPLETION_EVENT)
#none of the following calls work to get the correct 3d position, phew!
# x,y,z = bigH2O.getPosition(viz.ABS_GLOBAL)
# x,y,z = bigH2O.getBoundingBox().center
#hardcoded value below, until the sunny day when Worldviz gets us a call for the correct position of a 3d node!
co2Path.remove()
x,y,z = globals_oa.h2OLocationUntilWeChangeAgain[0], globals_oa.h2OLocationUntilWeChangeAgain[1], globals_oa.h2OLocationUntilWeChangeAgain[2]
print x,y,z
moveToH2O = vizact.moveTo([x,y,z] , speed = .75)
yield viztask.addAction(bigCO2, moveToH2O)
#yield viztask.waitTime(.05)
#Fade molecules from bigCO2 and bigH2O to H2CO3 animation
h2co3molecule.setPosition(globals_oa.h2CO3LocationUntilWeChangeAgain)
lowPolyMole.enable(viz.RENDERING)
highPolyMole.disable(viz.RENDERING)
h2co3molecule.visible(viz.ON)
h2co3molecule.setAnimationTime(8.9) #starts animation at 17.8 seconds
# h2co3molecule.setAnimationSpeed(0.1)
h2co3molecule.setAnimationLoopMode(0)
# viztask.waitTime(.5)
fadeOut = vizact.fadeTo(0, time=1)
lowPolyMole.addAction(fadeOut)
bigH2O.addAction(fadeOut)
yield viztask.waitTime(5)
bigCO2.visible(viz.OFF)
bigH2O.visible(viz.OFF)
示例10: trialCountDownTask
def trialCountDownTask():
"""Task that count downs to time limit for trial"""
# Action for text fading out
text_fade = vizact.parallel(
vizact.fadeTo(0,time=0.8,interpolate=vizact.easeOut)
,vizact.sizeTo([.1,.1,.1],time=0.8,interpolate=vizact.easeOut)
)
# Reset time text
time_text.clearActions()
time_text.alpha(1.0)
time_text.color(viz.BLACK)
time_text.setScale([.05,.05,.05])
time_text.message('REMAINING: ' + str(int(globals_oa.TIME_TO_FIND_IN_SCAVENGER_HUNT)/60)+ ':' + str(int(globals_oa.TIME_TO_FIND_IN_SCAVENGER_HUNT)%60).zfill(2))
# Countdown from time limit
start_time = viz.getFrameTime()
last_remain = int(globals_oa.TIME_TO_FIND_IN_SCAVENGER_HUNT)
while (viz.getFrameTime() - start_time) < globals_oa.TIME_TO_FIND_IN_SCAVENGER_HUNT:
# Compute remaining whole seconds
remain = int(math.ceil(globals_oa.TIME_TO_FIND_IN_SCAVENGER_HUNT - (viz.getFrameTime() - start_time)))
# Update text if time remaining changed
if remain != last_remain:
if remain <= 5:
time_text.alpha(1.0)
time_text.color(viz.RED)
time_text.setScale([.05]*3)
time_text.runAction(text_fade)
time_text.message(str(remain/60)+ ':'+str(remain%60).zfill(2))
last_remain = remain
# Wait tenth of second
yield viztask.waitTime(0.1)
print 'OUT OF TIME'
示例11: FallAction
def FallAction():
"""Flashes screen red and animates blur effect"""
flash_quad.visible(True)
flash_quad.color(viz.RED)
fade_out = vizact.fadeTo(viz.BLACK,time=2.5)
flash_quad.runAction(vizact.sequence(fade_out,vizact.method.visible(False)))
flash_quad.runAction(vizact.call(blurEffect.setDistance,vizact.mix(50,0,time=2.5)),pool=1)
示例12: ResetMill
def ResetMill (self):
hatch = self.components['hatch'+self.LR]
hatch.addAction(vizact.moveTo([0,0,0], time=1, interpolate=vizact.easeInOut))
self.tankPulp.setPosition(0,0,0)
self.components['paste'+self.LR].alpha(0)
self.components['paste'+self.LR].visible(0)
tank = self.components['tank'+self.LR]
tank.setPosition(0,0,0)
tank.setEuler(0,0,0)
tank.alpha(0)
tank.addAction(vizact.method.visible(1))
tank.addAction(vizact.fadeTo(1, begin=0, time=.5))
self.tankPulp.setPosition(0,0,0)
self.cart.getChild('pourPulp').remove()
self.cart.getChild('pulp').remove()
self.cart.addAction(vizact.fadeTo(0, time=.5))
self.cart.addAction(vizact.method.remove())
示例13: TrialCountDownTask
def TrialCountDownTask():
"""Task that count downs to time limit for trial"""
global revealSelf
global manChase
# Action for text fading out
text_fade = vizact.parallel(
vizact.fadeTo(0,time=0.8,interpolate=vizact.easeOut)
,vizact.sizeTo([1.5,1.5,1.0],time=0.8,interpolate=vizact.easeOut)
)
# Reset time text
time_text.clearActions()
time_text.alpha(1.0)
time_text.color(viz.WHITE)
time_text.setScale([1,1,1])
time_text.message(str(int(TRIAL_DURATION)))
# Countdown from time limit
start_time = viz.getFrameTime()
last_remain = int(TRIAL_DURATION)
male2.clearActions()
male2.setPosition(2.5,0,7.5)
while (viz.getFrameTime() - start_time) < TRIAL_DURATION:
if revealSelf:
pigeon.clearActions()
pos = viz.MainView.getPosition()
pigeon.addAction( vizact.walkTo([pos[0], 0, pos[2]]) )
if manChase:
male.clearActions()
male2.state(2)
pos = pigeon.getPosition()
male2.addAction( vizact.walkTo([pos[0] - .5, 0, pos[2] - .5]))
if male2.getPosition()[2] == (pigeon.getPosition()[2] - .5):
#allow for other actions to take place (chase takes precedence)
manChase = False
male2.state(9)
# Compute remaining whole seconds
remain = int(math.ceil(TRIAL_DURATION - (viz.getFrameTime() - start_time)))
# Update text if time remaining changed
if remain != last_remain:
if remain <= 5:
time_text.alpha(1.0)
time_text.color(viz.RED)
time_text.setScale([1]*3)
time_text.runAction(text_fade)
viz.playSound('sounds/beep.wav')
time_text.message(str(remain))
last_remain = remain
# Wait tenth of second
yield viztask.waitTime(0.1)
示例14: FillMat
def FillMat (self):
self.paste1.setPosition(0,0,0)
self.paste2.setPosition(0,-.02,0)
self.paste1.addAction(vizact.method.visible(1))
self.paste1.addAction(vizact.fadeTo(1, time=.5))
self.paste1.addAction(vizact.moveTo([0,-.1,0], time=2))
self.paste2.addAction(vizact.waittime(1))
self.paste2.addAction(vizact.method.visible(1))
self.paste2.addAction(vizact.moveTo([0,0,0], time=2))
示例15: PasteInTank
def PasteInTank (self):
hatch = self.components['hatch'+self.LR]
hatch.addAction(vizact.moveTo([.3-.275, .976-.879, -0.956+.907], time=1, interpolate=vizact.easeInOut))
hatch.addAction(vizact.waittime(1))
openSignal = vizact.signal()
hatch.addAction(openSignal.trigger)
# code for pouring animation
self.pourPulp.addAction(openSignal.wait)
self.pourPulp.addAction(vizact.fadeTo(1, time=.5))
self.pourPulp.addAction(vizact.waittime(5))
self.pourPulp.addAction(vizact.fadeTo(0, time=.5))
self.tankPulp.addAction(openSignal.wait)
self.tankPulp.addAction(vizact.waittime(.5))
self.tankPulp.addAction(vizact.moveTo([0,.4,0], time=5, interpolate=vizact.easeOut))
self.mixedPulp.addAction(openSignal.wait)
# self.mixedPulp.addAction(vizact.fadeTo(0, time=5))
move = vizact.moveTo([0, -.28, 0], time=5, interpolate=vizact.easeOut)
resize = vizact.sizeTo([.85,1,.85], time=5, interpolate=vizact.easeOut)
self.mixedPulp.addAction(vizact.parallel(move, resize))