vuott 16-09-2020, 03:01
Os dejo un Metronomo para console muy muy sencillo: Shy

Código:
Private Const METRONOMO As String = "|------||------|"


Public Sub Main()

  Dim t, d, bpm As Short
  Dim mtr As String

  bpm = 90

  t = 1
  Print
 
  Do
    d += Sgn(Sin(2 * Pi(1) * (t / 32)))
    mtr = METRONOMO
    Mid(mtr, d, 1) = "\e[31m\e[1mO\e[0m"
    Write #File.Out, "\r" & mtr & " = " & CStr(bpm) & " bpm   "
    Flush #File.Out
    If t == 31 Then t = 1
    Wait (60 / bpm) / 16
    Inc t
  Loop
 
End
vuott 15-09-2020, 18:11
Os dejo este simple codigo para dibujar la Espiral de Arquímedes:

Código:
Private DrAr As DrawingArea
Private Const A As Float = 4.0
Private Const B As Float = 4.0
Private Const KYKLOS As Float = 26.0
Private Const PASOS As Integer = 200
Private incr As Float = 1.0 / PASOS

 
Public Sub Form_Open()
 
  With Me
    .W = Screen.AvailableWidth
    .H = Screen.AvailableHeight
    .Center
  End With
  With DrAr = New DrawingArea(Me) As "DrAr"
    .X = 0
    .Y = 0
    .W = Me.W
    .H = Me.H
    .Background = Color.White
  End With
 
End


Public Sub DrAr_Draw()
 
  Dim x, y As Integer
  Dim i As Float
 
  x = DrAr.W / 2
  y = DrAr.H / 2
 
  With Paint
    While i <= KYKLOS * Pi
      .FillRect(x + (A + B * i) * Cos(i), y + (A + B * i) * Sin(i), 2, 2, Color.Red)
      i += incr
    Wend
    .End
  End With
 
End
vuott 15-09-2020, 17:14
Para obtener un efecto caleidoscópico de una imagen de formato PNG con los recursos del Componente gb.media, es necesario utilizar el elemento "kaleidoscope" de la libreria de Gstreamer.

Ejemplo práctico muy sencillo:
Código:
Private tb As ToggleButton
Private dr As DrawingArea
Private imm As String
Private pl As MediaPipeline


Public Sub _new()

  Dim w As Integer
  Dim h As Integer
 
   imm = "/ruta/del/archivo/imagen.png"
 
   w = ImageStat(imm).Width
   h = ImageStat(imm).Height
 
   With Me
     .W = w + 200
     .H = w + 100
   End With
 
   With tb = New ToggleButton(Me) As "Tasto"
     .X = Me.w - 30
     .Y = 10
     .W = 30
     .H = 40
     .Text = "Start"
   End With
 
   With dr = New DrawingArea(Me)
     .X = 0
     .Y = 0
     .W = w
     .H = h
   End With

End


Public Sub Form_Open()

  Dim src, pdc, kal, con1, frz, con2, snk As MediaControl

   pl = New MediaPipeline
 
   src = New MediaControl(pl, "filesrc")
   src["location"] = imm
   pdc = New MediaControl(pl, "pngdec")
   kal = New MediaControl(pl, "kaleidoscope")
   kal["angle"] = Rad(45)
   kal["angle2"] = Rad(140)
   kal["sides"] = 10
   con1 = New MediaControl(pl, "videoconvert")
   frz = New MediaControl(pl, "imagefreeze")
   con2 = New MediaControl(pl, "videoconvert")
   snk = New MediaControl(pl, "xvimagesink")
 
   src.LinkTo(pdc)
   pdc.LinkTo(kal)
   kal.LinkTo(con1)
   con1.LinkTo(frz)
   frz.LinkTo(con2)
   con2.LinkTo(snk)
 
   snk.SetWindow(dr)
 
End


Public Sub Tasto_Click()          ' _
 
 If tb.Value Then
   pl.Play()
   tb.Text = "Stop"
 Else
   pl.Stop()
   pl.Close()
   Me.Close
 Endif
 
End
Páginas (557):    1 523 524 525 526 527 557   
Bienvenido, Invitado
Tienes que registrarte para poder participar en nuestro foro.
Recordarme?
Miembros: 285
Último miembro: XLRG
Temas del foro: 1,720
Mensajes del foro: 8,927
Últimos temas
Archivos .ods
Foro: General
Último mensaje por: cogier, Hace 1 hora
Respuestas: 3 - Vistas: 49
Un sistema de ayudas cont...
Foro: Videotutoriales
Último mensaje por: guizans, 22-06-2025, 19:55
Respuestas: 3 - Vistas: 253
Publicidad
Foro: Sobre gambas-es.org
Último mensaje por: Shordi, 18-06-2025, 07:35
Respuestas: 5 - Vistas: 257
Web con gambas, a ver si ...
Foro: WebApp/WebForms
Último mensaje por: jackrobot, 16-06-2025, 17:11
Respuestas: 40 - Vistas: 32,311
Crear una aplicación para...
Foro: Bases de Datos
Último mensaje por: Shell, 29-05-2025, 20:11
Respuestas: 11 - Vistas: 1,387
Powered By MyBB, © 2002-2025 MyBB Group.
Made with by Curves UI.