VPython - example - A simple redblue stereovision effort

本Python脚本通过视觉效果展示了一次名为Renaissance 2005的活动介绍,其中包括标题的渐变效果和颜色变化等动画。此脚本使用了visual.text模块来创建文本,并通过调整场景范围和视场角实现动画效果。

本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。允许非商业转载,但应注明作者及出处。


作者:liuyuan_jq

2011-04-10

From http://linuxgazette.net/144/john.html


#!/usr/bin/env python # -*- coding:utf-8 -*- from visual.text import * import time #importing pygame to play the background music :) #import pygame #Uncomment it if you have the redblue goggles scene.stereo='redblue' scene.title = "Renaissance" #scene.fullscreen = 1 scene.fov = 0.001 scene.range = 0 rate(100) # Uncomment this if you need to play the background music #pygame.mixer.init() #intromusic=pygame.mixer.Sound("/usr/share/sounds/KDE_Startup.wav") #pygame.mixer.Sound.play(intromusic) def intro(): Title= text(pos=(0,3,0), string='MCA PROUDLY PRESENTS', color=color.red, depth=0.3, justify='center') for i in range(20): rate(10) scene.range = i Title.makeinvisible() scene.range = 0 Header= text(pos=(0,3,0), string='RENAISSANCE 2005', color=color.yellow, depth=0.3, justify='center') for i in range(20): rate(10) scene.fov = 3 scene.range = i # Now play with colors Header.reshape(color= color.cyan) time.sleep(1) Header.reshape(color= color.blue) time.sleep(1) Header.reshape(color= color.green) time.sleep(1) Header.reshape(color=color.orange) time.sleep(1) Header.reshape(color= color.red) # Now let's delete the Header Header.makeinvisible() scene.range = 10 scene.fov = 0.2 Body= text(pos=(0,3,0), string='A CELEBRATION OF LINUX ', color=color.red, depth=0.3, justify='center') Body.reshape(color=color.orange) #Here I am not adding the rest of the code as it just shows the schedule of that days programs # Invoking intro() if __name__ == '__main__': intro()

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值