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 (569):    1 535 536 537 538 539 569   
Bienvenido, Invitado
Tienes que registrarte para poder participar en nuestro foro.
Recordarme?
Miembros: 300
Último miembro: Armando56
Temas del foro: 1,756
Mensajes del foro: 9,128
Últimos temas
Un interprete de basic en...
Foro: HTML, CSS, Javascript
Último mensaje por: guizans, 03-02-2026, 23:34
Respuestas: 5 - Vistas: 246
El ratón no hace click do...
Foro: Instalación
Último mensaje por: guizans, 30-01-2026, 20:41
Respuestas: 2 - Vistas: 201
Parámetro de clase y pará...
Foro: General
Último mensaje por: guizans, 30-01-2026, 20:40
Respuestas: 8 - Vistas: 407
Gmao-Factory: Aplicación ...
Foro: Python
Último mensaje por: jguardon, 25-01-2026, 15:53
Respuestas: 5 - Vistas: 310
SqetchDB, un proyecto re-...
Foro: General
Último mensaje por: guizans, 21-01-2026, 19:57
Respuestas: 8 - Vistas: 480
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.