动画需求:
左侧69个点,右侧69个点
左右的点之间可以交叉连接,具体左侧哪个点连接到右侧哪个点由用户用鼠标指定或这从数据库中读取,然后在这两个点之间自动画一条线,这69条线最好能像电路板上的连线那样规则
请问基于什么技术实现比较好,如Flash动画 或者别的什么技术?
想用VB编程做一个实时动画,如何实现
答案:2 悬赏:70 手机版
解决时间 2021-02-26 17:08
- 提问者网友:沉默的哀伤
- 2021-02-25 17:26
最佳答案
- 五星知识达人网友:持酒劝斜阳
- 2021-02-25 18:23
就使用picture甚至什么都不用,就在form上作图。
答案补充:
以下代码的界面为窗体上放二个shape,名称均为默认名。
Option Explicit
Const 数量 = 69, 行距 = 150, 列距 = 60, 左 = 1300
Dim 状态 As Integer, 文字宽 As Single, 横坐标 As Single, 纵坐标 As Single, 顶 As Single
Dim 选中1 As Integer, 选中2 As Single, 左图心 As Single, 右图心 As Single, 中间 As Single
Dim 已用左(1 To 数量) As Boolean, 已用右(1 To 数量) As Boolean, 右 As Single
Private Sub Form_Click()
If Timer1.Enabled Then Exit Sub
If Abs(横坐标 - 左图心) < 行距 / 2 Then
选中1 = 纵坐标 \ 行距 + 1
If 已用左(选中1) Then Exit Sub
Shape1.Move 左图心 - 行距 / 4 + 15, (选中1 - 0.5) * 行距 - 15
Shape1.Visible = True
If 状态 = 2 Then
中间 = 左图心 + 行距 / 4 + 525 + 列距 * 选中1
Timer1.Enabled = True
Else
状态 = 1
End If
ElseIf Abs(横坐标 - 右图心) < 行距 / 2 Then
选中2 = 纵坐标 \ 行距 + 1
If 已用右(选中2) Then Exit Sub
Shape2.Move 右图心 - 行距 / 4 + 15, (选中2 - 0.5) * 行距 - 15
Shape2.Visible = True
If 状态 = 1 Then
中间 = 左图心 + 行距 / 4 + 525 + 列距 * 选中1
Timer1.Enabled = True
Else
状态 = 2
End If
End If
End Sub
Private Sub Form_DblClick()
初始界面
End Sub
Private Sub Form_Load()
Dim i As Integer
Me.AutoRedraw = True
Me.FontSize = 7
文字宽 = TextWidth("A12")
Height = 数量 * 行距 + 800
Width = 数量 * 列距 + 2 * (左 + 行距 + 文字宽) + 1050
Top = 0
Left = (Screen.Width - Width) / 2
右 = Width - 左 - 文字宽
左图心 = 左 + 文字宽 + 行距
右图心 = Width - 左图心
With Shape1
.Shape = 3
.FillStyle = 0
.FillColor = RGB(128, 128, 128)
.Visible = False
.Height = 行距 / 2 - 15
.Width = 行距 / 2 - 15
End With
With Shape2
.Shape = 3
.FillStyle = 0
.FillColor = RGB(128, 128, 128)
.Visible = False
.Height = 行距 / 2 - 15
.Width = 行距 / 2 - 15
End With
Me.Cls
初始界面
Timer1.Interval = 20
End Sub
Private Sub 初始界面()
Dim i As Integer
Print "单击选节点;"
Print "双击重开始。"
For i = 1 To 数量
顶 = (i - 1) * 行距
CurrentY = 顶
CurrentX = 左
Print "A"; Format(i, "00");
CurrentX = 右
Print "B"; Format(i, "00")
Me.Circle (左图心, (i - 0.5) * 行距), 行距 / 4, vbRed
Me.Circle (右图心, (i - 0.5) * 行距), 行距 / 4, vbBlue
已用左(i) = False
已用右(i) = False
Next i
Timer1.Enabled = False
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
横坐标 = X
纵坐标 = Y
End Sub
Private Sub Timer1_Timer()
Static 线段 As Integer, 步子 As Integer, i As Integer
Select Case 线段
Case 0
步子 = 步子 + 1
Line (左图心 + 行距 / 4, (选中1 - 0.5) * 行距)-(左图心 + 行距 / 4 + 步子 * 30, (选中1 - 0.5) * 行距), RGB(20, 150, 20)
If CurrentX >= 中间 Then
线段 = 1
步子 = 0
End If
Case 1
步子 = 步子 + 1
If 选中1 < 选中2 Then
Line (中间, (选中1 - 0.5) * 行距)-(中间, (选中1 - 0.5) * 行距 + 步子 * 30), RGB(20, 150, 20)
If CurrentY >= (选中2 - 0.5) * 行距 Then
线段 = 2
步子 = 0
End If
ElseIf 选中1 > 选中2 Then
Line (中间, (选中1 - 0.5) * 行距)-(中间, (选中1 - 0.5) * 行距 - 步子 * 30), RGB(20, 150, 20)
If CurrentY <= (选中2 - 0.5) * 行距 Then
线段 = 2
步子 = 0
End If
Else
线段 = 2
步子 = 0
End If
Case 2
步子 = 步子 + 1
Line (中间, (选中2 - 0.5) * 行距)-(中间 + 步子 * 30, (选中2 - 0.5) * 行距), RGB(20, 150, 20)
If CurrentX >= 右图心 - 行距 / 4 Then
线段 = 3
步子 = 0
End If
Case 3
已用左(选中1) = True
已用右(选中2) = True
线段 = 0
Timer1.Enabled = False
状态 = 0
Shape1.Visible = False
Shape2.Visible = False
End Select
End Sub
答案补充:
以下代码的界面为窗体上放二个shape,名称均为默认名。
Option Explicit
Const 数量 = 69, 行距 = 150, 列距 = 60, 左 = 1300
Dim 状态 As Integer, 文字宽 As Single, 横坐标 As Single, 纵坐标 As Single, 顶 As Single
Dim 选中1 As Integer, 选中2 As Single, 左图心 As Single, 右图心 As Single, 中间 As Single
Dim 已用左(1 To 数量) As Boolean, 已用右(1 To 数量) As Boolean, 右 As Single
Private Sub Form_Click()
If Timer1.Enabled Then Exit Sub
If Abs(横坐标 - 左图心) < 行距 / 2 Then
选中1 = 纵坐标 \ 行距 + 1
If 已用左(选中1) Then Exit Sub
Shape1.Move 左图心 - 行距 / 4 + 15, (选中1 - 0.5) * 行距 - 15
Shape1.Visible = True
If 状态 = 2 Then
中间 = 左图心 + 行距 / 4 + 525 + 列距 * 选中1
Timer1.Enabled = True
Else
状态 = 1
End If
ElseIf Abs(横坐标 - 右图心) < 行距 / 2 Then
选中2 = 纵坐标 \ 行距 + 1
If 已用右(选中2) Then Exit Sub
Shape2.Move 右图心 - 行距 / 4 + 15, (选中2 - 0.5) * 行距 - 15
Shape2.Visible = True
If 状态 = 1 Then
中间 = 左图心 + 行距 / 4 + 525 + 列距 * 选中1
Timer1.Enabled = True
Else
状态 = 2
End If
End If
End Sub
Private Sub Form_DblClick()
初始界面
End Sub
Private Sub Form_Load()
Dim i As Integer
Me.AutoRedraw = True
Me.FontSize = 7
文字宽 = TextWidth("A12")
Height = 数量 * 行距 + 800
Width = 数量 * 列距 + 2 * (左 + 行距 + 文字宽) + 1050
Top = 0
Left = (Screen.Width - Width) / 2
右 = Width - 左 - 文字宽
左图心 = 左 + 文字宽 + 行距
右图心 = Width - 左图心
With Shape1
.Shape = 3
.FillStyle = 0
.FillColor = RGB(128, 128, 128)
.Visible = False
.Height = 行距 / 2 - 15
.Width = 行距 / 2 - 15
End With
With Shape2
.Shape = 3
.FillStyle = 0
.FillColor = RGB(128, 128, 128)
.Visible = False
.Height = 行距 / 2 - 15
.Width = 行距 / 2 - 15
End With
Me.Cls
初始界面
Timer1.Interval = 20
End Sub
Private Sub 初始界面()
Dim i As Integer
Print "单击选节点;"
Print "双击重开始。"
For i = 1 To 数量
顶 = (i - 1) * 行距
CurrentY = 顶
CurrentX = 左
Print "A"; Format(i, "00");
CurrentX = 右
Print "B"; Format(i, "00")
Me.Circle (左图心, (i - 0.5) * 行距), 行距 / 4, vbRed
Me.Circle (右图心, (i - 0.5) * 行距), 行距 / 4, vbBlue
已用左(i) = False
已用右(i) = False
Next i
Timer1.Enabled = False
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
横坐标 = X
纵坐标 = Y
End Sub
Private Sub Timer1_Timer()
Static 线段 As Integer, 步子 As Integer, i As Integer
Select Case 线段
Case 0
步子 = 步子 + 1
Line (左图心 + 行距 / 4, (选中1 - 0.5) * 行距)-(左图心 + 行距 / 4 + 步子 * 30, (选中1 - 0.5) * 行距), RGB(20, 150, 20)
If CurrentX >= 中间 Then
线段 = 1
步子 = 0
End If
Case 1
步子 = 步子 + 1
If 选中1 < 选中2 Then
Line (中间, (选中1 - 0.5) * 行距)-(中间, (选中1 - 0.5) * 行距 + 步子 * 30), RGB(20, 150, 20)
If CurrentY >= (选中2 - 0.5) * 行距 Then
线段 = 2
步子 = 0
End If
ElseIf 选中1 > 选中2 Then
Line (中间, (选中1 - 0.5) * 行距)-(中间, (选中1 - 0.5) * 行距 - 步子 * 30), RGB(20, 150, 20)
If CurrentY <= (选中2 - 0.5) * 行距 Then
线段 = 2
步子 = 0
End If
Else
线段 = 2
步子 = 0
End If
Case 2
步子 = 步子 + 1
Line (中间, (选中2 - 0.5) * 行距)-(中间 + 步子 * 30, (选中2 - 0.5) * 行距), RGB(20, 150, 20)
If CurrentX >= 右图心 - 行距 / 4 Then
线段 = 3
步子 = 0
End If
Case 3
已用左(选中1) = True
已用右(选中2) = True
线段 = 0
Timer1.Enabled = False
状态 = 0
Shape1.Visible = False
Shape2.Visible = False
End Select
End Sub
全部回答
- 1楼网友:酒安江南
- 2021-02-25 19:34
方法一:选择windows media player,打开自定义,把选择模式选择none方法二:使用其他控件,比如activemovie希望能帮助你。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯