用VB编写的齿轮的动画 全部程序文档格式.docx
- 文档编号:18477409
- 上传时间:2022-12-17
- 格式:DOCX
- 页数:18
- 大小:18.73KB
用VB编写的齿轮的动画 全部程序文档格式.docx
《用VB编写的齿轮的动画 全部程序文档格式.docx》由会员分享,可在线阅读,更多相关《用VB编写的齿轮的动画 全部程序文档格式.docx(18页珍藏版)》请在冰豆网上搜索。
Command1.BackColor=RGB(Int(Rnd*256),Int(Rnd*256),Int(Rnd*256))
(2)PrivateSubCommand1_Click()
Command1.Visible=False
Command2.Visible=True
Picture1.Visible=True
Picture1.Cls
Command2.Value=False
Command3.Value=False
Timer1.Enabled=False
Timer2.Enabled=False
'
开始画第一个齿轮
rb1=170/2*Cos(PI/9)
ra1=190/2
rf1=(17-2-0.5)*10/2
Picture1.Scale(-120,-200)-(370,200)
画渐开线——
Picture1.DrawWidth=1.2
Picture1.Circle(0,0),2,QBColor(15)
rk1=rb1
i=jiao*PI/180
Fora1=19/17*i+0To2*PI+19/17*iStep2*PI/17
mn1=a1+14*PI/180
mm1=a1+12.5*PI/180
z21=rf1*Cos(mn1)
z22=rf1*Sin(mn1)
X1112=rb1*Cos(mm1)
Y1112=rb1*Sin(mm1)
Picture1.Line(z21,z22)-(X1112,Y1112),QBColor(15)
gk1=Tan(Atn(Sqr(1-rb1/rk1*rb1/rk1)/rb1*rk1))-Atn(Sqr(1-rb1/rk1*rb1/rk1)/rb1*rk1)'
展角与rk的关系
b1=a1+gk1
sb1=PI*10/2*Cos(PI/9)-10*17*Cos(PI/9)*(PI/9-Tan(PI/9))
X1111=rb1*Cos(b1-gk1)
Y1111=rb1*Sin(b1-gk1)
画齿根圆弧
Forp1=a1-7*PI/180Toa1-1*PI/180Step0.4*PI/180
z11=rf1*Cos(p1)
z12=rf1*Sin(p1)
Picture1.PSet(z11,z12),QBColor(15)
Nextp1
Picture1.Line(z11,z12)-(X1111,Y1111),QBColor(15)
Forrk1=rb1Tora1Step0.4
gk1=Tan(Atn(Sqr(1-rb1/rk1*rb1/rk1)/rb1*rk1))-Atn(Sqr(1-rb1/rk1*rb1/rk1)/rb1*rk1)'
b1=a1+gk1
sb1=PI*10/2*Cos(PI/9)-10*17*Cos(PI/9)*(PI/9-Tan(PI/9))
X1=rk1*Cos(b1)
Y1=rk1*Sin(b1)
Ifb1=a1Then
bx1=X1
By1=Y1
Picture1.PSet(bx1,By1),QBColor(15)
Else
Picture1.PSet(X1,Y1),QBColor(15)
EndIf
Nextrk1
w1=sb1/rb1
d1=a1+w1-gk1
X12=rk1*Cos(d1)
Y12=rk1*Sin(d1)
Ifd1=w1Then
bx12=X12
By12=Y12
Picture1.PSet(bx12,By12),QBColor(15)
Picture1.PSet(X12,Y12),QBColor(15)
Nexta1
Fork1=0+19/17*iTo2*PI+19/17*iStep2*PI/17
Fork11=k1+gk11+4.5*PI/180Tok1+sb1/rb1-gk11-3.8*PI/180Step0.3*PI/180
x111=ra1*Cos(k11)
y111=ra1*Sin(k11)
Picture1.PSet(x111,y111),QBColor(15)
Nextk11
Nextk1
第一个齿轮结束
开始画第二个齿轮
rb2=190/2*Cos(PI/9)
ra2=(19+2)*10/2
rf2=(19-2-0.5)*10/2
Picture1.Circle(183,0),2,QBColor(12)
Fora2=0+7.88*PI/180-iTo2*PI+7.88*PI/180-iStep2*PI/19
mn2=a2-6.5*PI/180
mm2=a2-7.5*PI/180
z2121=183+rf2*Cos(mn2)
z2222=rf2*Sin(mn2)
X2112=183+rb2*Cos(mm2)
Y2112=rb2*Sin(mm2)
Picture1.Line(z2121,z2222)-(X2112,Y2112),QBColor(12)
X2111=183+rb2*Cos(a2)
Y2111=rb2*Sin(a2)
Forp2=a2-6*PI/180Toa2-0.8*PI/180Step0.4*PI/180
z111=183+rf2*Cos(p2)
z121=rf2*Sin(p2)
Picture1.PSet(z111,z121),QBColor(12)
Nextp2
Picture1.Line(z111,z121)-(X2111,Y2111),QBColor(12)
Forrk2=rb2Tora2Step0.4
gk2=Tan(Atn(Sqr(1-rb2/rk2*rb2/rk2)/rb2*rk2))-Atn(Sqr(1-rb2/rk2*rb2/rk2)/rb2*rk2)'
b2=a2+gk2
sb2=PI*10/2*Cos(PI/9)-10*19*Cos(PI/9)*(PI/9-Tan(PI/9))
X2=183+rk2*Cos(b2)
Y2=rk2*Sin(b2)
Ifb2=a2Then
bx2=X2
By2=Y2
Picture1.PSet(bx2,By2),QBColor(12)
Picture1.PSet(X2,Y2),QBColor(12)
Nextrk2
w2=sb2/rb2
d2=a2+w2-gk2
X22=183+rk2*Cos(d2)
Y22=rk2*Sin(d2)
Ifd2=w2Then
bx22=X22
By22=Y22
Picture1.PSet(bx22,By22),QBColor(12)
Picture1.PSet(X22,Y22),QBColor(12)
齿根圆圆弧
Nexta2
Fork2=0+7.88*PI/180-iTo2*PI+7.88*PI/180-iStep2*PI/19
gk22=Tan(Atn(Sqr(1-rb2/ra2*rb2/ra2)/rb2*ra2))-Atn(Sqr(1-rb2/ra2*rb2/rk2)/rb2*ra2)
Fork22=k2+gk22Tok2+sb2/rb2-gk2Step0.3*PI/180
x222=183+ra2*Cos(k22)
y222=ra2*Sin(k22)
Picture1.PSet(x222,y222),QBColor(12)
Nextk22
Nextk2
PrivateSubCommand2_Click()
Label1.Visible=True
Label2.Visible=True
Command4.Visible=True
VScroll1.Visible=True
Command3.Visible=True
IfCommand2.Caption="
白色齿轮顺时针转"
Then
Command2.Caption="
白色齿轮逆时针转"
Timer1.Enabled=True
Constjiao=0
Timer1.Interval=100-VScroll1.Value
Else
Timer2.Enabled=True
Timer2.Interval=100-VScroll1.Value
PrivateSubCommand3_Click()
VScroll1.Visible=False
Label1.Visible=False
Label2.Visible=False
PrivateSubCommand4_Click()
i=MsgBox("
真的要退出?
"
vbOKCancel+vbQuestion+vbDefaultButton1,"
请注意!
)
Ifi=1Then
End
PrivateSubCommand5_Click()
Form3.Show
PrivateSubForm_Load()
Command4.Visible=False
Picture1.Visible=False
Command2.Visible=False
Command3.Visible=False
sb2=PI*10/2*Cos(PI/9)-10*19*Cos(PI/9)*(PI/9-Ta
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 用VB编写的齿轮的动画 全部程序 VB 编写 齿轮 动画 全部 程序
![提示](https://static.bdocx.com/images/bang_tan.gif)