Stanley Sathler Posted September 7, 2013 Share Posted September 7, 2013 Hello guys, Today I started to create some stuffs here, and I had an idea: create a GUI element (an image created using dxDrawImage()) and shake it when the player move his mouse over the image. I need help with the shake effect. How could I do this? Someone has something that could help me? Thought about maybe use setElementRotation(), but maybe I would need to use some timers too. I need a simple tutorial about how to create this shake effect. A little explanation. Link to comment
qaisjp Posted September 7, 2013 Share Posted September 7, 2013 Hey Stanley, as far as I know, setElementRotation doesn't work on GUI elements. Do you want to wiggle it like or make it rotate all around?EDIT: Confirmed you can't use setElementRotation on GUI elements EDIT2: you can use interpolateBetween and getEasingFunction. its a bit complicated but you can easily get used to it with practice Link to comment
Stanley Sathler Posted September 7, 2013 Author Share Posted September 7, 2013 Hey Concerned, Yes, it is exactly what I want to do (this effect in the video). But the effect would be like this: I'll try use these functions, but I'll still accepting new suggestions. If someone has a function already created and would like to share, I will love him forever. Link to comment
Dealman Posted September 7, 2013 Share Posted September 7, 2013 I don't think you could achieve this without using dxDrawImage. Which already has 'native' support for rotation. EDIT2: you can use interpolateBetween and getEasingFunction. its a bit complicated but you can easily get used to it with practice Correct me if I'm wrong, but I believe you can only actually re-size your UI Elements with interpolateBetween, and not actually rotate it via this function...? Link to comment
qaisjp Posted September 7, 2013 Share Posted September 7, 2013 Dealman, you can do anything with interpolateBetween From animating a line across the screen to making an object bounce in the 3D world! Since you cannot rotate GUI elements I suggest that you use the easing functions to make an effect which is similar to this. It could consist of it shaking side to side so you might have to chain up animations. I don't have much experience with the easing functions and I've only ever played with them in the 1.1 nightly when they were introduced by Kayl. Other than that, images are the way to go if you want to stick to rotating. Link to comment
50p Posted September 7, 2013 Share Posted September 7, 2013 You cannot rotate GUI elements but you can do it with DX functions. Link to comment
Jesseunit Posted September 7, 2013 Share Posted September 7, 2013 There's an example that swings an arrow (dxImage) across your screen (https://wiki.multitheftauto.com/wiki/DxDrawImage) You could use that example to see how they did it. Link to comment
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