Skip to content
This repository was archived by the owner on Oct 19, 2025. It is now read-only.

Commit 00332e8

Browse files
committed
Brush pressure with calculated angle
1 parent 1695f40 commit 00332e8

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

Client/js/brushes/lightTrail.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,9 @@ lightTrail.prototype =
7373
scope.context.closePath();
7474
}
7575

76-
var xPos = this.positionX;
77-
var yPos = this.positionY;
78-
7976
context.save();
80-
context.translate(xPos, yPos);
81-
context.rotate(scope.determineAngle(xPos, yPos, xPos, yPos));
77+
context.translate(this.positionX, this.positionY);
78+
context.rotate(scope.angle);
8279
scope.context.drawImage(scope.lightCycle, 0, 0, 33.33, 12.66);
8380
context.restore();
8481
}
@@ -106,7 +103,7 @@ lightTrail.prototype =
106103
//wtf?
107104
}
108105
return angle;
109-
}
106+
},
110107

111108
destroy: function()
112109
{
@@ -131,22 +128,20 @@ lightTrail.prototype =
131128
//new coordinates moved to
132129
stroke: function( positionX, positionY )
133130
{
134-
/*//To Do uncomment when angle function available function is
135-
angle = getAngle(positionX, positionY);
131+
var angle = this.determineAngle(this.positionX, this.positionY, positionX, positionY);
136132

137-
if (angle > 0 && angle <= 45){
133+
if ((angle > 0 && angle <= 90) || (angle > 135 && angle <= 180)){
138134
BRUSH_PRESSURE = 30;
139-
}else if(angle > 45 && angle <= 90){
135+
}else if((angle > 90 && angle <= 135) || (angle > 180 && angle < 360)){
140136
BRUSH_PRESSURE = 15;
141137
}else{
142-
//angle is 0
138+
//angle is 0 or 360
143139
BRUSH_PRESSURE = 1;
144140
}
145141

146142
this.positionX = positionX;
147143
this.positionY = positionY;
148-
*/
149-
144+
this.angle = angle;
150145

151146
},
152147

0 commit comments

Comments
 (0)