Jump to content

How to shake the screen


Sohail Ahmad
 Share

Recommended Posts

Well, you asked "is there any idea how to shake screen", I gave you a couple of ideas.

Math.random() returns a random value between 0 and 1 (float value), which can be manupulated by multiplying, rounding, adding and subtracting from what you need.

Math.sin(angle) returns a value between -1 and 1 based on the input angle (which can easily be a counter value, to which you add 0.1 on each frame for example). This second solution is harder and also needs a dampening function (which will reduce amplitude over time) to make for a realistic effect.

 

Load all this to your brain, add a little bit of google and shake a little.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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