Jump to content

[Ayuda] Interpolate


Recommended Posts

Hola amigos, tanto tiempo me dirian como ponerle interpolate a "Colt" y "silenciada"? Colt y silenced es una Imagen si me podrian ayudar se los agradeceria.

Aqui les dejo el script:

local x, y = guiGetScreenSize ( ) 
local Foxes = dxCreateFont( "Foxes.ttf", 17 ) 
local visible = false 
Arma = "Ninguna" 
Precio = "$--" 
  
local guiWidgets = { 
        Colt = guiCreateStaticImage(x*0.45, y*0.2395833333333333, x*0.1015625, y*0.1458333333333333, "Imagenes/Colt.png", false), 
    Silenciada = guiCreateStaticImage(x*0.559375, y*0.2395833333333333, x*0.1015625, y*0.1458333333333333, "Imagenes/Silenciada.png", false) 
} 
        
for k, i in pairs( guiWidgets ) do 
        guiSetVisible( i, false ) 
end 
  
function userpanel() 
        Ancho = x*0.434375 
        Alto = y*0.1270833333333333 
  
        Ancho2 = x*0.425 
        Alto2 = y*0.1270833333333333 
        
        Ancho3 = x*0.4484375 
        Alto3 = y*0.1395833333333333 
  
        local now = getTickCount() 
        local elapsedTime = now - start 
        local endTime = start + 1100 
        local duration = endTime - start 
        local progress = elapsedTime / duration 
        local x1, y1 = interpolateBetween ( 700, 61, 0, Ancho, Alto, 255, progress, "Linear") 
        local x2, y2 = interpolateBetween ( 700, 61, 0, Ancho2, Alto2, 255, progress, "Linear") 
        local x3, y3 = interpolateBetween ( 1100, 61, 0, Ancho3, Alto3, 255, progress, "Linear") 
        
    dxDrawRectangle(x1, y1, x*0.565625, y*0.7479166666666667, tocolor(0, 0, 0, 170), false) 
    dxDrawRectangle(x2, y2, x*0.009375, y*0.7479166666666667, tocolor(0, 91, 255, 170), false) 
    dxDrawText("Tienda de #0091ffarmas#ffffff.", x3, y3, x*0.984375, y*0.21875, tocolor(255, 255, 255, 255), 1.00, Foxes, "center", "center", false, false, false, true, false) 
end 
  
function abrir() 
    bindKey("F2", "down", 
        function() 
                        if not visible then 
                                start = getTickCount() 
                addEventHandler("onClientRender", root, userpanel ) 
                                        for k, i in pairs( guiWidgets ) do 
                        guiSetVisible( i, true ) 
                    end 
                visible = true 
                showCursor( true ) 
            else 
                removeEventHandler("onClientRender", root, userpanel ) 
                                        for k, i in pairs( guiWidgets ) do 
                        guiSetVisible( i, false ) 
                    end 
                showCursor( false ) 
                visible = false 
            end 
        end 
    ) 
end 
addEventHandler("onClientResourceStart", root, abrir) 

Link to comment

Usando la diferencia del getTicCount de Now menos la del Start.

EJ:

local counter = now - start 

Y ahí tienes un contador de milisegundos, luego puedes hacer algunos arreglos.

EJ:

  
--Sabiendo que ya teniamos una variable global definida como x=0 
if counter < 1000 then --1000 refleja 1 segundo 
    x=x+1 
    dxDrawImage(500+x,.......) --suponiendo que 500 es tu pocicion inicial, y que tu pocicion final sera la que pusiste en el if (1000), sumandolas quedarias en 1500 de pocicion final. 
end 
     

Link to comment
asd no te entiendo a que quieres llegar..

No me puedes corregir mi codigo y ya? es que no entiendo lo que quieres poner o decir

Trata de interpretar lo que te puse, no esta con respecto a tu código, es solo un ejemplo de como se hacen animaciones usando esa función, si te corrijo tu código te estaría haciendo todo el trabajo.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...