Capacitación básica en Computación
Excellent program!. Animation and sound
High level programming Nonki. congratulations
Program Listing VXK727 - http://smallbasic.com/program/?VXK727
……………………………………………………………………………….
‘ 30-second Animation Edited ‘Nonki Takahashi
gw = GraphicsWindow.Width
gh = GraphicsWindow.Height
dx = gw / 6
dy = gh / 3
fs = 60
x0 = dx - fs / 2
y0 = dy - fs
GraphicsWindow.FontSize = fs
GraphicsWindow.BrushColor = ”Orange”
t0 = Clock.ElapsedMilliseconds
For i = 1 To 10
obj[i] = Shapes.AddText(i)
x[i] = x0 + dx * Math.Remainder(i - 1, 5)
y[i] = y0 + dy * Math.Floor((i - 1) / 5)
Shapes.Move(obj[i], gw + fs, y[i])
EndFor
song1 = ”O4C4C8C8C4C8C8E4G8G8E4C4D4D8D8D4D8D8O3B4O4D8D8O3B4G4″
song2 = ”O4C4C8C8C4C8C8E4G8G8E4C4G4F4E4D4C1″
int = 770
Timer.Interval = int
f = 0
Timer.Tick = OnTick
Sound.PlayMusic(song1)
Sound.PlayMusic(song2)
Sound.PlayMusic(song1)
Sound.PlayMusic(song2)
Sub OnTick
t1 = Clock.ElapsedMilliseconds
f = f + 1
sec = Math.Floor((t1 - t0) / 1000)
GraphicsWindow.Title = sec + ”[sec]“
MoveObj()
EndSub
Sub MoveObj
If f <= 3 Then ‘ 1, 2, 3
Shapes.Animate(obj[f], x[f], y[f], int)
ElseIf f = 4 Then
ElseIf f <= 7 Then ‘ 4, 5, 6
Shapes.Animate(obj[f - 1], x[f - 1], y[f - 1], int)
ElseIf f = 8 Then
ElseIf f <= 11 Then ‘ 7, 8, 9
Shapes.Animate(obj[f - 2], x[f - 2], y[f - 2], int)
ElseIf f = 12 Then
ElseIf f = 13 Then ‘ 10
Shapes.Animate(obj[f - 3], x[f - 3], y[f - 3], int)
ElseIf f <= 17 Then
ElseIf f <= 19 Then ‘ 10, 9
Shapes.Animate(obj[28 - f], -fs * 2, y[27 - f], int)
ElseIf f = 20 Then
ElseIf f <= 23 Then ‘ 8, 7, 6
Shapes.Animate(obj[29 - f], -fs * 2, y[29 - f], int)
ElseIf f = 24 Then
ElseIf f <= 27 Then ‘ 5, 4, 3
Shapes.Animate(obj[30 - f], -fs * 2, y[30 - f], int)
ElseIf f = 28 Then
ElseIf f = 29 Then ‘ 2
Shapes.Animate(obj[2], -fs * 2, y[2], int)
ElseIf f <= 37 Then
ElseIf f = 38 Then ‘ 1
Shapes.Animate(obj[1], -fs * 2, y[1], int)
Else
Timer.Pause()
GraphicsWindow.BrushColor = ”DimGray”
GraphicsWindow.DrawText(gw / 2 - fs ,gh / 2 - fs, ”End”)
EndIf
EndSub
‘ Copyright (c) Microsoft Corporation. All rights reserved.
http;//www.empiezoinformatica.wordpress.com
%d bloggers like this:
No comments:
Post a Comment