Here is the code I’ve been trying to use but it’s not working…
$w.onReady(function () {
// Get a reference to the image and the button using their IDs
const myImage = $w(‘#myImage’);
const rotateButton = $w(‘#rotateButton’);
// Add a click event handler to the button
rotateButton.onClick(() => {
// Get the current rotation angle of the image
const currentRotation = myImage.rotate;
// Rotate the image 30 degrees clockwise (adding 30 to the current angle)
const newRotation = currentRotation + 30;
// Set the new rotation angle for the image
myImage.rotate = newRotation;
});
});