AJXB Posted April 7, 2014 Posted April 7, 2014 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 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.
cheez3d Posted April 7, 2014 Posted April 7, 2014 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)
AJXB Posted April 7, 2014 Author Posted April 7, 2014 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 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.
cheez3d Posted April 7, 2014 Posted April 7, 2014 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 IIYAMA Posted April 7, 2014 Moderators Posted April 7, 2014 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 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. When you choose InQuad, it will move fast in the beginning and slow down at the end. When you choose OutQuad, it will move slow in the beginning and speed up later. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now