Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5970403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:22:11+00:00 2026-05-22T20:22:11+00:00

I have a canvas object, a circle, that currently animates along a particular path,

  • 0

I have a canvas object, a circle, that currently animates along a particular path, rather like a bounce. The simple animation code is as follows:

if (x + dx > canvasW || x + dx < 0) dx = -dx;
if (y + dy > canvasH || y + dy < 0) dy = -dy;   
x += dx;
y += dy;

Where dx and dy are set offets to increase the path by.

I’d like to make it follow a random path, such as a fly might.

How would I go about this? Are there any tutorials anyone could point me in the direction of? I’ve struggled to find any either here or via Google.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:22:11+00:00Added an answer on May 22, 2026 at 8:22 pm

    You can find an implementation of the idea you proposed here. You might want to tweak it a bit but at least it’s a start. 🙂

    In case you want to make the trajectory smoother, try evaluating a Bézier curve. Before that you’ll have to generate a bunch of points in which to apply the algo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Have a canvas and would like to place silverlight elements within that canvas
In my WPF application, I have a Canvas object that contains some UserControl objects.
I have noticed that everyone working with the Canvas object multiply their way around
I have an abstract class, Shape, and I have a Canvas object that the
I've got a circle that I've drawn on a canvas. I'd like to draw
I have two images that i want to draw into a canvas object. I
I have a function that creates an image with the canvas object. The last
I have a canvas in Flex that shall be able only to be scrolled
I have a Canvas in a Flex application which has items inside it that
As part of an application, I have a canvas object <Canvas Name=canvas/> into which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.