-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch.diff
More file actions
96 lines (96 loc) · 2.55 KB
/
patch.diff
File metadata and controls
96 lines (96 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
diff --git a/js/ColorHelper.js b/js/ColorHelper.js
new file mode 100644
index 0000000..8451b3c
--- /dev/null
+++ b/js/ColorHelper.js
@@ -0,0 +1,29 @@
+define(['paper'],function (s) {
+ return {
+ darken: function (color,offset){
+ console.log(color, offset)
+ if(offset>1){
+ offset = offset/100;
+ }
+ if(offset){
+ color.brightness = color.brightness - offset;
+ }
+ console.log(color,offset);
+ },
+ lighten: function (color,offset){
+ console.log(color,offset);
+ if(offset>1){
+ offset = offset/100;
+ }
+ if(offset){
+ color.brightness = color.brightness+offset
+ }
+ console.log(color,offset);
+ },
+ spin: function (color,angle){
+ console.log(color,offset);
+ color.hue = (color.hue+angle)%360;
+ console.log(color,offset);
+ }
+ }
+})
\ No newline at end of file
diff --git a/js/Transform.js b/js/Transform.js
new file mode 100644
index 0000000..8371a5e
--- /dev/null
+++ b/js/Transform.js
@@ -0,0 +1,30 @@
+// ================
+// = Class Matrix =
+// ================
+define(['paper','m'],function (s,m) {
+ var Transform = function (_super,type){
+ this.scale = 0.8602;
+ switch (type){
+ case 'top':
+ this.shear_h = Math.asin(0.57);
+ this.rotate = -30;
+ break;
+ case 'left':
+ this.shear_h = Math.asin(0.57);
+ this.rotate = 30;
+ break;
+ case 'right':
+ this.shear_h = -Math.asin(0.57);
+ this.rotate = -30;
+ break;
+ }
+ this._super = _super;
+ };
+ Transform.prototype.applyTransform = function () {
+ this._super.polygon.scale(1,this.scale);
+ console.log(this.shear_h)
+ this._super.polygon.shear(this.shear_h,0);
+ this._super.polygon.rotate(this.rotate);
+ }
+ return Transform;
+});
\ No newline at end of file
diff --git a/js/m.js b/js/m.js
new file mode 100644
index 0000000..a46b034
--- /dev/null
+++ b/js/m.js
@@ -0,0 +1,16 @@
+define(
+ {
+ factor: Math.PI/180,
+
+ sin : function (angle) { return Math.sin(this.toRad(angle));},
+ cos : function (angle) { return Math.cos(this.toRad(angle));},
+ tan : function (angle) { return Math.tan(this.toRad(angle));},
+
+ asin : function (value) { return this.toDeg(Math.asin(value));},
+ acos : function (value) { return this.toDeg(Math.acos(value));},
+ atan : function (value) { return this.toDeg(Math.atan(value));},
+
+ toDeg : function (value) { return value*this.factor;},
+ toRad : function (angle) { return angle/this.factor},
+ }
+)
\ No newline at end of file