Jump to content

interpolateBetween


AJXB

Recommended Posts

function onRender( )
	local px, py = guiGetPosition ( pic,false )
	local sx,sy = guiGetScreenSize ()
	local nx, ny = interpolateBetween ( px, py,0,px,(py/3)+475,0,getProgress( 7500 ),"OutElastic",2,2,2)
	guiSetPosition( pic, nx, ny, false )
end
addEventHandler( 'onClientRender', root, onRender )

I don't know what am I doing wrong, but this image, is only moving, not jumping and such.. if you know what I mean, OutElastic shouldn't be Linear :S

NOTE: pic is created, getProgress function is added

2,2,2 is added because I don't really know what these numbers do e.e

Link to comment
  
local px,py = guiGetPosition(pic,false) 
local sx,sy = guiGetScreenSize() 
local function render_handler() 
    local nx,ny = interpolateBetween(px,py,0,px,(py)/3+475,0,getProgress(7500),"OutElastic",2,2,2) 
    guiSetPosition(pic,nx,ny,false) 
end 
addEventHandler("onClientRender",root,render_handler) 
  

Link to comment
  
local px,py = guiGetPosition(pic,false) 
local sx,sy = guiGetScreenSize() 
local function render_handler() 
    local nx,ny = interpolateBetween(px,py,0,px,(py)/3+475,0,getProgress(7500),"OutElastic",2,2,2) 
    guiSetPosition(pic,nx,ny,false) 
end 
addEventHandler("onClientRender",root,render_handler) 
  

well I don't really understand what you have changed, you did change this (py/3)+475 to (py)/3+475 and this caused wrong math :P Anyway, I guess you tried, appreciate it

Link to comment
  • Moderators
function onRender( )
	local px, py = guiGetPosition ( pic,false )
	local sx,sy = guiGetScreenSize ()
	local nx, ny = interpolateBetween ( px, py,0,px,(py/3)+475,0,getProgress( 7500 ),"OutElastic",2,2,2)
	guiSetPosition( pic, nx, ny, false )
end
addEventHandler( 'onClientRender', root, onRender )

I don't know what am I doing wrong, but this image, is only moving, not jumping and such.. if you know what I mean, OutElastic shouldn't be Linear :S

NOTE: pic is created, getProgress function is added

2,2,2 is added because I don't really know what these numbers do e.e

Easing functions like "Linear" and "OutElastic" do only affect the speed of moving.

When you choose Linear, it will move with the same speed.

Qeasingcurve-linear.png

When you choose InQuad, it will move fast in the beginning and slow down at the end.

Qeasingcurve-inquad.png

When you choose OutQuad, it will move slow in the beginning and speed up later.

Qeasingcurve-outquad.png

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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