POV-Ray : Newsgroups : povray.animations : Animation with sine waves? Server Time
25 Jul 2026 13:24:49 EDT (-0400)
  Animation with sine waves? (Message 1 to 4 of 4)  
From: Sir
Subject: Animation with sine waves?
Date: 23 Jul 2026 00:35:00
Message: <web.6a619842b7fdf4e0e541bb4fe358f448@news.povray.org>
Hello POV-Ray Users!

So, i was rendering an animation of a metronome whose pendulum swings back and
forth between a specific angle and its negative.

Here's how I did it:

#declare maxangle = 35;
#declare actangle = maxangle * sin( clock * 4 ) * cos( clock * 4 );

polygon {
5,
<-.06,0>, <-.06,2.6>, <.06,2.6>, <.06,0>, <-.06,0>
         texture{ Chrome_Metal
                  // normal { bumps 0.5 scale 0.05 }
                  // finish { phong 1 }
                } // end of texture ---------------------------
    translate <0,0,0>
    rotate <0,0,clock*actangle>
    translate <0,.3,-.8>

   }
}
object { metronome
scale .5 }

This is not the complete scene, just the pendulum, which is a polygon that
rotates (maxangle value).

(I'm not an experienced user, and I don't know much about trigonometry and stuff
like that, srry.)

However, the pendulum doesn't swing back and forth constantly (as it should);
instead, it moves a very short distance at the beginning of the animation, and
as the animation progresses, the distance it travels increases until it exceeds
the angle that had been set (or so I think) as the maximum.

If anyone knows what's going on and how to fix it, I would really appreciate
it if you could share your knowledge with me.

Thanks!

(sorry if my english is bad, most of this post was translated)

- S I R ?


Post a reply to this message

From: ingo
Subject: Re: Animation with sine waves?
Date: 23 Jul 2026 01:35:00
Message: <web.6a61a77230cd75d17bac71e8ffb8ce3@news.povray.org>
"Sir" <fra### [at] jaliscoedumx> wrote:

> #declare actangle = maxangle * sin( clock * 4 ) * cos( clock * 4 );
> [...]
>     rotate <0,0,clock*actangle>

Didn't analyse the full thing but noticed the clock as well in actangle as in
rotate again. So you animate the animation, removing the clock from rotate might
do the trick?

ingo


Post a reply to this message

From: Bald Eagle
Subject: Re: Animation with sine waves?
Date: 23 Jul 2026 06:10:00
Message: <web.6a61e78c30cd75dd1d09a9825979125@news.povray.org>
"ingo" <nomail@nomail> wrote:
> "Sir" <fra### [at] jaliscoedumx> wrote:
>
> > #declare actangle = maxangle * sin( clock * 4 ) * cos( clock * 4 );
> > [...]
> >     rotate <0,0,clock*actangle>
>
> Didn't analyse the full thing but noticed the clock as well in actangle as in
> rotate again. So you animate the animation, removing the clock from rotate might
> do the trick?
>
> ingo

Also, why is sin getting multiplied by cos?
I would just use cos to oscillate between 1 and -1.

- BE


Post a reply to this message

From: kurtz le pirate
Subject: Re: Animation with sine waves?
Date: 25 Jul 2026 05:53:25
Message: <6a648795$1@news.povray.org>
On 23/07/2026 06:30, Sir wrote:
> 
> Hello POV-Ray Users!
> 
> So, i was rendering an animation of a metronome whose pendulum swings back and
> forth between a specific angle and its negative.
> 

Hello 'Sir Francisco',

I think you're making things harder on yourself....


For exemple :

// 50 degrees -> +/- 25 deg or something else, of course
#declare Amplitude = 50;
#declare HalfAmplitude = Amplitude*0.50;


Object to animate is "Object"

object {
   Object
   rotate sin(clock*tau)*HalfAmplitude*z
   }

'clock' from 0.0 to 1.0


In this exemple, oscillations is around z-axis.

I hope this helps...




-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message


Attachments:
Download 'metronome.mp4.dat' (45 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.