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 6626985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:57:33+00:00 2026-05-25T21:57:33+00:00

As I wanted to animate an image in projectile motion, My code is as

  • 0

As I wanted to animate an image in projectile motion,
My code is as follows, but it did not reach the target and give projectile animation, any help please?

-(void)timeLine
{

dTime += 0.1;


.................


double s_x =   inVel * cos(angle1)  ; // the X speed
double s_y =   inVel * sin(angle1) ;  // the Y speed


NSLog(@"sx = %i",s_x);

NSLog(@"sy = %i",s_y);


x =   oX + (s_x * dTime);
y =   oY + ( ( s_y * dTime) - (0.5 * 9.8 * dTime * dTime));

NSLog(@"x = %i",x);

NSLog(@"y = %i",y);

imageViewForAnimation.x += x;
imageViewForAnimation.y -= y;
}
  • 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-25T21:57:34+00:00Added an answer on May 25, 2026 at 9:57 pm
    imageViewForAnimation.x += x;
    imageViewForAnimation.y -= y;
    

    These lines don’t seem right to me. You are calculating the actual x and y each time, not the difference moved since the last time. I’m also uncertain why one was being added and one was being subtracted, but that’s beside the point. Basically, try changing the lines to

    imageViewForAnimation.x = x;
    imageViewForAnimation.y = y;
    

    Also, you’re doing some calculations over and over which only need to be done once. v_x == s_x (or it should within floating point error) as well as v_y == s_y. You only need to calculate v_x and V_y once beforehand rather than calculating them every time you update the coordinates.

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

Sidebar

Related Questions

This Monotouch code below will not cause an exception, but it also won't show
I wanted to highlight an element with this: $('input.step:last').css('background','#003').animate({'background':'#fff'},300); But it doesn't work. http://jsfiddle.net/Cpwmm/
Wanted to know if someone had a suggestion on code or maybe there's a
I wanted to show the users Name Address (see www.ipchicken.com ), but the only
I wanted to generate one fix view using interface builder, but the size of
Current code: $(document).ready(function(){ $('#go').hover( function(){ // Change the input image's source when we roll
I move with jQuery an element to the left and I wanted to animate
I am new to jqwicket. Basically I wanted to know how to add animation
I've a slight problem with jQuery animation. First I'll provide my code: <div id=xp_container>
We wanted to use a UITabBar in our iPhone app, but with one exception:

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.