猫史档案馆


【Python作品分享】3D

用户:糖果PB糖果PB查看:0 回复:0 评论:0 创建时间:2022-08-25T22:06:08


【作品展示】

center_image

 

【作品介绍】

3d

 

【作品源代码】

from vpython import *

ball = sphere(pos=vector(0,0,0),radius=0.25, color=color.red)
pad = box(pos=vector(0, -2, 0), size=vector(1,0.1,1), color=color.white)
dt = 0.01
speed = 2
a = 102
while True:
    rate(100)
    ball.pos.y -= speed * dt
    if ball.pos.y <= pad.pos.y + 0.1:
        speed = -speed
    if ball.pos.y > 0:
        speed = -speed

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页