Rabu, 10 Februari 2010

ANIMASI TEKS BERJALAN PADA MICROSOFT EXCEL

Private Sub DAControl_Start()
Set m = DAControl.MeterLibrary

'// Set of number behaviors
Set zero = m.DANumber(0)
Set half = m.DANumber(0.5)
Set one = m.DANumber(1)
Set two = m.DANumber(2)

Set oscillatingNumber = m.Sin(m.LocalTime)

'// Create a time varying color
Set txtCol = m.ColorHslAnim(m.Abs(oscillatingNumber), m.DANumber(0.5), m.DANumber(0.5))

Set FontStyle = m.Font("Verdana", -24, txtCol)

Set textImg = m.StringImage("SELAMAT DATANG DI PEMROGRAMAN 2D & 3D GRAFIS MICROSOFT DIRECT X", FontStyle)

'// Get the height and width of the text.
Set scrollingTextBounds = textImg.BoundingBox

Set scrollingTextLength = m.Sub(scrollingTextBounds.Max.X, scrollingTextBounds.Min.X)
Set scrollingTextWidth = m.Sub(scrollingTextBounds.Max.Y, scrollingTextBounds.Min.Y)

'// Get the control width and hegiht.
Set icontrolWidth = m.Mul(m.DANumber(300), m.Pixel)
Set controlHeight = m.Mul(m.DANumber(40), m.Pixel)


'// first we move the text off the right hand side of the control
'// remember that text comes up centered, so we first move the left portion to the right of center
'// and then move by half the width of the control to the right. Also center the text vertically
'// across the control

Set horizontalOffset = m.Add(m.Neg(scrollingTextBounds.Min.X), m.Div(icontrolWidth, m.DANumber(2)))
Set verticalOffset = m.Neg(m.Div(scrollingTextWidth, m.DANumber(4)))

Set scrollingTextImage = textImg.Transform(m.Translate2Anim(horizontalOffset, verticalOffset))

'// Number of scrolling steps
Set scrollingSteps = m.DANumber(400)

'// how fast to scroll
Set scrollingSpeed = m.Mod(m.Mul(m.LocalTime, m.DANumber(9)), scrollingSteps)

'// we need to scroll the width of the control plus the length of the string
Set iScrollWidth = m.Add(icontrolWidth, scrollingTextLength)

'// this defines the translation
Set scrollingRate = m.Mul(m.Neg(scrollingSpeed), m.Div(iScrollWidth, scrollingSteps))

Set scrollingTextTranslation = m.Translate2Anim(scrollingRate, zero)

Set scrollingTextImage = scrollingTextImage.Transform(scrollingTextTranslation)


DAControl.TimerSource = 1

'// set the image to be displayed
DAControl.Image = m.Overlay(scrollingTextImage, m.SolidColorImage(m.Black))

DAControl.Sound = m.Silence

'// start the animation
DAControl.Start
End Sub

1 komentar:

Anonim mengatakan...

dijelasin donk !!! x_x