Skip to main content
Dirlo
Inspiring
July 31, 2018
Question

Rotation of an object

  • July 31, 2018
  • 2 replies
  • 476 views

...

Hello !...

I'm starting to work on the clock !... (What a challenge !... )

I already manage to do many great things... But I have a problem with the rotation of the hands.

I want the students to be able to rotate the hands clockwise and anti-clockwise.

So I made a "+" button to rotate the minute hand clockwise. I use the cpt effect "rotate 6°" for each minute. And it works fine.

I also made à "-" button to rotate the same hand anti-clockwise (using also the cpt effect "rotate -6°"), and when I did so, the hand returns to its original (vertical) position before the rotation !...

So for example, if I rotate the minute hand to 20 using the "+" button, and then I want the hand to be on the 19, if I click on the "-" button, the hand returns to its original position before rotating... And this is not what I want !...

Don't know If I'm crystal clear !... ...

I will make some screenshots !...

And I clik on the "-" button one time this happens :

So the minute hand returns to its original position before rotating, and I want to avoid that !...

Is this possible ??...

...

I also made a button to reinitialize everything (Remise à zéro) but I don't know how to make the hands returning to their initial positions (vertical)...

...

And as I'm here another question :

I found the cpt variables for the hour and the minute... but not for the second !... Is it possible to get it ?...

...

Thanks in advance for your help !...

...

This topic has been closed for replies.

2 replies

Dirlo
DirloAuthor
Inspiring
July 31, 2018

...

I finally manage to do it... but with 60 conditional actions !!!... (1 for each minute you have guessed !...)

I created a variable called "Minute", and my minute hand is called "G_Aiguille".

So one of the action is for example :

If Minute = 12

Rotate "G_Aiguille" by 72 (6x12)

Luckily for the hour hand, I will have only 12 conditional actions !...

...

Thank you KeyPoint for your answer, but I don't see the seconds on your project ?

...

Lilybiri
Legend
July 31, 2018

What about using the While loop?

Dirlo
DirloAuthor
Inspiring
July 31, 2018

...

Hello Lily !...

"While loop" ??... Never used it !... Dont' even know where to find it !... 

PS : If you can answer in Molière's language, it could be nice !... 

...

Inspiring
July 31, 2018

How do make the clock hands rotate? I would add custom states for the hour and minute hands and display the correct state whenever you increase/decrease the minute and hour variables. That would avoid having the hands to snap back first before they rotate. I had built an analog clock a long time ago, see here the second example: http://dev.keypointlearn.com/blog/clock/