Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Fixed rotation in Sketch 3.8 version
Browse files Browse the repository at this point in the history
After sketch updated to 3.8, rotation values not work properly and
values needed to set manually. This should fix the rotation problem.
  • Loading branch information
Creatide committed Jul 4, 2016
1 parent cb8d577 commit 137ddcd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ Animation.prototype.setKeyframeValues = function (keyframeNumber, valuesObject,
refKeyframe.y = valuesObject.y;
refKeyframe.width = valuesObject.width;
refKeyframe.height = valuesObject.height;
refKeyframe.rotation = valuesObject.rotation >= 360 ? 0 : valuesObject.rotation;

// Fix rotation issue after 3.8 update
if ( utils.sketchVersion >= '3.8' ) {
refKeyframe.rotation = valuesObject.rotation;
} else {
refKeyframe.rotation = valuesObject.rotation >= 360 ? 0 : valuesObject.rotation;
}

refKeyframe.opacity = Math.min(Math.max(parseFloat(valuesObject.opacity), 0), 1);
};
Expand Down
1 change: 1 addition & 0 deletions AnimateMate.sketchplugin/Contents/Sketch/library/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function Utils() {
// General values
this.scriptName = 'AnimateMate';
this.pluginDomain = "com.creatide.sketch.animatemate";
this.sketchVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:"CFBundleShortVersionString"];
this.scriptPath = null;
this.scriptPathRoot = null;
this.scriptResourcesPath = null;
Expand Down
2 changes: 1 addition & 1 deletion AnimateMate.sketchplugin/Contents/Sketch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "Creatide",
"authorEmail": "hello@creatide.com",
"homepage": "http://github.com/Creatide/AnimateMate",
"version": "0.1.2",
"version": "0.1.3",
"identifier": "com.creatide.sketch.animatemate",
"compatibleVersion": "3.5.2",
"bundleVersion": 1,
Expand Down

0 comments on commit 137ddcd

Please sign in to comment.