Skip to content

Commit

Permalink
Merge pull request #20540 from code-dot-org/artist-num-frames-unifica…
Browse files Browse the repository at this point in the history
…tion

Don't special-case how Frozen frames are calculated
  • Loading branch information
joshlory committed Feb 10, 2018
2 parents 9b1660d + 31a8826 commit fe41e8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
5 changes: 3 additions & 2 deletions apps/src/turtle/skins.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ exports.load = function (assetUrl, id) {
anna: {
// slider speed gets divided by this value
speedModifier: 10,
turtleNumFrames: 10,
avatarSettings: {
width: 73,
height: 100,
numHeadings: 36,
numFrames: 10,
},
smoothAnimate: true,
consolidateTurnAndMove: true,
Expand All @@ -40,11 +40,11 @@ exports.load = function (assetUrl, id) {

elsa: {
speedModifier: 10,
turtleNumFrames: 20,
avatarSettings: {
width: 73,
height: 100,
numHeadings: 18,
numFrames: 20,
},
decorationAnimationNumFrames: 19,
smoothAnimate: true,
Expand Down Expand Up @@ -118,6 +118,7 @@ exports.load = function (assetUrl, id) {
width: 70,
height: 51,
numHeadings: 180,
numFrames: 1,
};

// Get properties from config
Expand Down
10 changes: 3 additions & 7 deletions apps/src/turtle/turtle.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,6 @@ Artist.prototype.drawTurtle = function () {
}
this.drawDecorationAnimation("before");

var sourceY;
// Computes the index of the image in the sprite.
var index = Math.floor(this.heading * this.avatar.numHeadings / 360);
if (this.isFrozenSkin()) {
Expand All @@ -751,12 +750,9 @@ Artist.prototype.drawTurtle = function () {
index = (index + this.avatar.numHeadings / 2) % this.avatar.numHeadings;
}
var sourceX = this.avatar.width * index;
if (this.isFrozenSkin()) {
sourceY = this.avatar.height * turtleFrame;
turtleFrame = (turtleFrame + 1) % this.skin.turtleNumFrames;
} else {
sourceY = 0;
}
var sourceY = this.avatar.height * turtleFrame;
turtleFrame = (turtleFrame + 1) % this.avatar.numFrames;

var sourceWidth = this.avatar.width;
var sourceHeight = this.avatar.height;
var destWidth = this.avatar.width;
Expand Down

0 comments on commit fe41e8a

Please sign in to comment.