1、画几个齿轮,大小随意,齿数对应,并按咬合关系调整好位置
2、分别复制散咐三、五个(因冲扰纯为齿轮的齿间距是相同的,所以动画起来,仅需几帧即可实现360度旋转效果,但帧数越多,动画越细腻李态),在每层上调整角度,使其与下一个齿距咬合,每一个咬合做一个图层。
3、打开动画面板,将图层转换为帧,设置时间,导出动画。
Const PI As Single = 3.1415926
Dim t As Single, r As Single
Private Sub Command1_Click()
t = PI / 20
r = Me.Picture1.ScaleHeight / 2 * 4 / 5
Me.Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Static i As Long
Me.Text1.Text = i + 1
'Me.Picture1.PSet (Me.Picture1.ScaleWidth / 2 + r * Cos(i * t), Me.Picture1.ScaleHeight / 2 - r * Sin(i * t)), vbRed
'Me.Picture1.PSet (Me.Picture1.ScaleWidth / 2 + (r + 100) * Cos(i * t + t / 2), Me.Picture1.ScaleHeight / 2 - (r + 100) * Sin(i * t + t / 2)), vbRed
Me.Picture1.Line (Me.Picture1.ScaleWidth / 2 + r * Cos(i * t), Me.Picture1.ScaleHeight / 2 - r * Sin(i * t))-(Me.Picture1.ScaleWidth / 2 + (r + 100) * Cos(i * t + t / 2), Me.Picture1.ScaleHeight / 2 - (r + 100) * Sin(i * t + t / 2))
Me.Picture1.Line (Me.Picture1.ScaleWidth / 2 + (r + 100) * Cos(i * t + t / 2), Me.Picture1.ScaleHeight / 2 - (r + 100) * Sin(i * t + t / 2))-(Me.Picture1.ScaleWidth / 2 + r * Cos((i + 1) * t), Me.Picture1.ScaleHeight / 2 - r * Sin((i + 1) * t))
i = i + 1
If i >2 * PI / t - 1 Then Me.Timer1.Interval = 0
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)