Jump to content

interpolateBetween


AJXB

Recommended Posts

Posted
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

~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names.

~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.

 

Posted
  
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) 
  

Posted
  
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

~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names.

~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.

 

Posted

I put the px,py,sx,sy variables outside onClientRender, otherwise you declare those variables every frame and the position of the picture will be different everytime. I tought you declared px and py as the start position of the animation.

  • Moderators
Posted
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

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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...