Jump to content

How to "shake" a GUI element


Recommended Posts

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

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

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

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