Q: How can I rotate an image in iAd by clicking on a button?
I wan't to create a iBooks Author Widget with an image (asset, protractor) that will rotate when I click a button (object).
The rotation angle must be adjustable by a TextField.
Please help me with this, my JavaScripts skills let me a bit down on this...
With Regards, Tom
So, the protractor (in dutch Geodriehoek) must rotate as I click on the button.
iBook, iOS 7.1, -
Posted on Mar 26, 2014 8:02 AM
For a simple field with a button to trigger the rotation, the button code would be somthing like:
this.onViewActivate = function (event) {
// Code here for the "Activated" event.
// myView is the outlet name of the object on the page I want to rotate
var myView = this.viewController.outlets.view;
// textField is the outlet name of the object where the degrees will be entered
var textField = this.viewController.outlets.textField;
// get the value from the field. Do checking to make sure it's a valid number
var newAngle = textField.value;
// create the CSS transform
var newValue = "rotateZ(" + newAngle + "deg)";
var myAngleTransition = new iAd.Transition({
target : myView,
properties : ['transform'],
from : [myView._transform],
to : [newValue],
duration : [1.5]
});
myAngleTransition.start();
};
Posted on Mar 27, 2014 12:05 PM
