Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: John1Connor en 23 Julio 2015, 08:34 am



Título: Efecto "Motion Blur" - html5 canvas VBScript
Publicado por: John1Connor en 23 Julio 2015, 08:34 am
Buenas, les traigo un pequeño aporte para los que se quieran iniciar en la programación de juegos en VBScript...  :P   (joda)
bueno, hablando en serio un efecto muy bueno para mover objetos y que se vea un poco mas "real" la ""camara"".

Movimiento sin efecto blur:
2oPHSuGpbDU

Movimiento con efecto blur:
CSF4Bfsom-A

Esto se puede abrir desde iexplorer online online pero descubri que rinde mucho pero mucho mas un HTA por eso el codigo es todo uno y es .hta:

Código
  1. <html>
  2. <head>
  3. <title>Motion Blur VBScript Canvas HTML5</title>
  4. <meta http-equiv="X-UA-Compatible" content="IE=10">
  5. <script language="vbscript">
  6. Option Explicit
  7. Dim img,i,PosY
  8. Dim Tiempo
  9. Dim DirectY
  10. DirectY = 10
  11. PosY = cint(50)
  12. window.resizeTo 800 , 600
  13.  
  14. Sub Main()
  15.    Dim canvas
  16.    Set canvas = document.getElementById("Canvas")
  17.    Dim ctx
  18.    Set ctx = canvas.getContext("2d")
  19. set img = document.getElementById("arbol")
  20. ctx.clearRect 0, 0,800,600
  21. ctx.drawImage img,50,PosY
  22. ctx.globalAlpha = 5
  23. for i=0 to 10
  24. if DirectY < 0 then
  25. ctx.drawImage img,50,PosY + i
  26. else
  27. ctx.drawImage img,50,PosY - i
  28. end if
  29. ctx.globalAlpha = 0.1
  30. next
  31. PosY = PosY + DirectY
  32. ctx.fillStyle = "#FFFFFF"
  33. ctx.font = "bold 30px sans-serif"
  34. ctx.fillText "PosY = " & PosY,500,400
  35. if PosY > 520 Then DirectY = cint(-10) end if
  36. if PosY < 0 Then DirectY = cint(10) end if
  37. Tiempo = SetTimeOut("Main()",25)
  38. ctx.stroke
  39. End Sub
  40.  
  41.  
  42.  
  43. </script>
  44. </head>
  45. <body onload="Main()" bgcolor="black">
  46. <img id="arbol" width="0" height="0" src="0.png">
  47. <canvas id="Canvas" width="800" height="600"></canvas>
  48. </body>
  49. </html>
  50.  


eso es todo. saludos




Nuevo video donde se aprecia mejor el efecto:
CKegeNyR8sU