Forum Discussion
Rotating a shape 90° shouldn't be too complicated but...
Hello community members.
A few words of context: for my latest entry in the e-learning challenge #482, I needed to rotate a rectangle by 90°, several times. I used good old motion trajectories, with settings of 1 and 0 pixels, and it works. I KNOW it's possible to do this with Javascript code more elegantly (transformation time and smooth motion), simpler (with far fewer variables), smarter, easier to modify, etc., but I don't know how. I've tried using parts of the solutions that you guys on the right side of this screen have proposed here and there, but I have failed. Fun fact : I literally spent a whole day (in cumulative hours) with ChapGPT to get him to help me write the code (about 20 versions) and it was a failure too. He accumulated errors: difficulties in simply identifying the form and selecting it, difficulties in running it, derailing the expected behavior of one part of the code while trying to fix another part. It's obvious that Chappy doesn't know enough about the inner workings of Storyline to create this code (which I'm sure is very simple). In the end, he apologized for having provoked my frustration. Yes, he did! But at least I've learned how to use SL's debugging console.
So I'm turning to you because I don't know JS at all. Can you help me, please? I'm going to execute this Javascript when I click on the rectangle mentioned below. Here's my (very simple) request:
There's a rectangle on my slide. I want to rotate it 90° clockwise, around its own center, in 1 second. When I click on it again, it rotates another 90°, from its previous position. In short, it rotates 360° in 4 clicks. And that's all there is to it!
This can be in pure JS or with GSAP, it doesn't matter (I'm not sure I know what I'm saying here, but whatever...).
And finally, please, please, please, can you make sure your code REALLY works? There are so many caring people out there who want to help but offer solutions that only work after 10 more messages of clarification and tweaking. It's frustrating too.
Many thanks in advance. I'll buy a French beer for anyone who succeeds.
Related Content
- 1 year ago
- 1 year ago
- 5 months ago