Silverlight多媒体与样式行为全解析
一、Silverlight动画与多媒体特性概述
在Silverlight应用开发中,我们可以通过代码实现动画效果。以下是一段用于实现矩形动画移动的代码:
' Attach the animation.
squareMoveStoryboard.Stop()
Storyboard.SetTarget(squareMoveStoryboard, rectangle)
' Choose a random direction and movement amount.
Dim rand As New Random()
Dim sign As Integer = 1
If rand.Next(0, 2) = 0 Then
sign = -1
End If
leftAnimation.To = Canvas.GetLeft(rectangle) + rand.Next(60,150) * sign
topAnimation.To = Canvas.GetTop(rectangle) + rand.Next(60, 150) * sign
' Store a reference to the square that's being animated.
previousRectangle = rectangle
' Start the animation.
squareMoveStoryboard.Begin()
End Sub
这段代码结合了视频、交互性,能产生比其他基于浏览器的应用平台更出色的效果。
超级会员免费看
订阅专栏 解锁全文
61

被折叠的 条评论
为什么被折叠?



