Last active
December 11, 2015 00:49
-
-
Save desireesantos/4519401 to your computer and use it in GitHub Desktop.
Controlar a posição da coordenada x,y
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var LinePositionControl = function (word, position) { | |
var YPosition = 180; | |
var marginRight = 980; | |
var coordinateXPosition = position; | |
this.currentPositionX = function () { | |
var textWidth = context.measureText(word).width; | |
coordinateXPosition < (coordinateXPosition - textWidth) ? coordinateXPosition + 10 : coordinateXPosition = 0; | |
printWord(); | |
return coordinateXPosition; | |
}; | |
var printWord = function () { | |
context.fillText(word, coordinateXPosition, YPosition); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Classe js responsável por controlar a posição da coordenada (X,Y) que representa a posição na linha onde a letra será exibida via canvas.