f00a2358 by Dan Rempel

EY global 300x600 done, but without expanding?

1 parent 590a3ef0
Showing 26 changed files with 305 additions and 30 deletions
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
109 <ul> 109 <ul>
110 <li class="dot1"></li> 110 <li class="dot1"></li>
111 <li class="dot2"></li> 111 <li class="dot2"></li>
112 <li class="dot3"></div> 112 <li class="dot3"></li>
113 </ul> 113 </ul>
114 114
115 </div> 115 </div>
......
1 <svg id="Graphics" xmlns="http://www.w3.org/2000/svg" width="142.93" height="183.74" viewBox="0 0 142.93 183.74"><defs><style>.cls-1{fill:#ffd400;}</style></defs><title>ey-yellow-square</title><path class="cls-1" d="M617.33,203h6.72v-6.72h-6.72V203Zm12.44,0h6.72v-6.72h-6.72V203Zm12.44,0h6.72v-6.72h-6.72V203ZM617.34,44.46v146.1h6.72V50.1L753.53,27.27l0,169H654.64V203H760.23l0-183.74Z" transform="translate(-617.33 -19.26)"/></svg>
...\ No newline at end of file ...\ No newline at end of file
1 <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="348.92" viewBox="0 0 300 348.92"><defs><style>.cls-1{fill:url(#linear-gradient);}</style><linearGradient id="linear-gradient" x1="150" y1="348.92" x2="150" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#231f20" stop-opacity="0"/><stop offset="1"/></linearGradient></defs><title>gradient</title><rect class="cls-1" width="300" height="348.92"/></svg>
...\ No newline at end of file ...\ No newline at end of file
1 /*!
2 * VERSION: 0.0.10
3 * DATE: 2016-02-11
4 * UPDATES AND DOCS AT: http://greensock.com
5 *
6 * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
7 * DrawSVGPlugin is a Club GreenSock membership benefit; You must have a valid membership to use
8 * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details.
9 * This work is subject to the software agreement that was issued with your membership.
10 *
11 * @author: Jack Doyle, jack@greensock.com
12 */
13 var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";function a(a,b,c,d){return c=parseFloat(c)-parseFloat(a),d=parseFloat(d)-parseFloat(b),Math.sqrt(c*c+d*d)}function b(a){return"string"!=typeof a&&a.nodeType||(a=_gsScope.TweenLite.selector(a),a.length&&(a=a[0])),a}function c(a,b,c){var d,e,f=a.indexOf(" ");return-1===f?(d=void 0!==c?c+"":a,e=a):(d=a.substr(0,f),e=a.substr(f+1)),d=-1!==d.indexOf("%")?parseFloat(d)/100*b:parseFloat(d),e=-1!==e.indexOf("%")?parseFloat(e)/100*b:parseFloat(e),d>e?[e,d]:[d,e]}function d(c){if(!c)return 0;c=b(c);var d,e,f,g,i,j,k,l=c.tagName.toLowerCase();if("path"===l){g=c.style.strokeDasharray,c.style.strokeDasharray="none",d=c.getTotalLength()||0;try{e=c.getBBox()}catch(m){}c.style.strokeDasharray=g}else if("rect"===l)d=2*c.getAttribute("width")+2*c.getAttribute("height");else if("circle"===l)d=2*Math.PI*parseFloat(c.getAttribute("r"));else if("line"===l)d=a(c.getAttribute("x1"),c.getAttribute("y1"),c.getAttribute("x2"),c.getAttribute("y2"));else if("polyline"===l||"polygon"===l)for(f=c.getAttribute("points").match(h)||[],"polygon"===l&&f.push(f[0],f[1]),d=0,i=2;i<f.length;i+=2)d+=a(f[i-2],f[i-1],f[i],f[i+1])||0;else"ellipse"===l&&(j=parseFloat(c.getAttribute("rx")),k=parseFloat(c.getAttribute("ry")),d=Math.PI*(3*(j+k)-Math.sqrt((3*j+k)*(j+3*k))));return d||0}function e(a,c){if(!a)return[0,0];a=b(a),c=c||d(a)+1;var e=g(a),f=e.strokeDasharray||"",h=parseFloat(e.strokeDashoffset),i=f.indexOf(",");return 0>i&&(i=f.indexOf(" ")),f=0>i?c:parseFloat(f.substr(0,i))||1e-5,f>c&&(f=c),[Math.max(0,-h),Math.max(0,f-h)]}var f,g=document.defaultView?document.defaultView.getComputedStyle:function(){},h=/(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi;f=_gsScope._gsDefine.plugin({propName:"drawSVG",API:2,version:"0.0.10",global:!0,overwriteProps:["drawSVG"],init:function(a,b,f){if(!a.getBBox)return!1;var g,h,i,j=d(a)+1;return this._style=a.style,b===!0||"true"===b?b="0 100%":b?-1===(b+"").indexOf(" ")&&(b="0 "+b):b="0 0",g=e(a,j),h=c(b,j,g[0]),this._length=j+10,0===g[0]&&0===h[0]?(i=Math.max(1e-5,h[1]-j),this._dash=j+i,this._offset=j-g[1]+i,this._addTween(this,"_offset",this._offset,j-h[1]+i,"drawSVG")):(this._dash=g[1]-g[0]||1e-6,this._offset=-g[0],this._addTween(this,"_dash",this._dash,h[1]-h[0]||1e-5,"drawSVG"),this._addTween(this,"_offset",this._offset,-h[0],"drawSVG")),!0},set:function(a){this._firstPT&&(this._super.setRatio.call(this,a),this._style.strokeDashoffset=this._offset,1===a||0===a?this._style.strokeDasharray=this._offset<.001&&this._length-this._dash<=10?"none":this._offset===this._dash?"0px, 999999px":this._dash+"px,"+this._length+"px":this._style.strokeDasharray=this._dash+"px,"+this._length+"px")}}),f.getLength=d,f.getPosition=e}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()();
...\ No newline at end of file ...\ No newline at end of file
1 /*!
2 * VERSION: 1.0.1
3 * DATE: 2016-04-28
4 *
5 * Requires:
6 * GSAP TweenMax
7 * GASP drawSVG Plugin ()
8 * This work is subject to the terms at http://greensock.com/standard-license or for
9 * Club GreenSock members, the software agreement that was issued with your membership.
10 *
11 * @license Copyright (c) 2016, Tenzing Communications Inc. All rights reserved.
12 *
13 * @author: Dan Rempel, dan@gotenzing.com
14
15 * Usage Example:
16 * var myEySvg = initEySvgFrame(10, 196, 193); // frame line weight, width, height
17 * document.getElementById("body").appendChild(myEySvg);
18 * animateEyFrame(2); // delay in seconds
19 * animateGradient(2); // delay in seconds
20 * animateFill(2); // delay in seconds
21 *
22 **/
23
24 var eySvg;var eyStroke;var eyDot1;var eyDot2;var eyDot3;var eyGradient;var eyFill;var tl;var eyStrokeWeight;var eySvgHeight;var eySvgWidth;var eyAngleHeight;var eyDotSpacing;var eyDotDuration=.2;var eyFrameDuration=1;var eyGradientDuration=1;var eyFillDuration=1;var eyColor="#FFD400";var svgNS="http://www.w3.org/2000/svg";var initEySvgFrame=function(a,b,c){tl=new TimelineMax();eyDotSpacing=Math.floor(a*8.5/10);eyStrokeWeight=a;eySvgWidth=b;eySvgHeight=c;var d=10*Math.PI/180;eyAngleHeight=Math.tan(d)*(b-a);var e=document.createElementNS(svgNS,"svg");e.setAttribute("id","ey-frame");e.setAttribute("width",b+"px");e.setAttribute("height",c+"px");e.setAttribute("viewBox","0 0 "+eySvgWidth+" "+eySvgHeight);var f=document.createElementNS(svgNS,"defs");e.appendChild(f);var g=document.createElementNS(svgNS,"linearGradient");g.setAttribute("id","linear-gradient");g.setAttribute("x1","0%");g.setAttribute("x2","0%");g.setAttribute("y1","0%");g.setAttribute("y2","100%");f.appendChild(g);var h;h=createStop({id:"stop-1",offset:"0%",color:"Black",opacity:".7"});g.appendChild(h);h=createStop({id:"stop-2",offset:"100%",color:"Black",opacity:"0"});g.appendChild(h);eyGradient=createShape("ey-gradient","url(#linear-gradient)");e.appendChild(eyGradient);eyDot1=createDot(1);e.appendChild(eyDot1);eyDot2=createDot(2);e.appendChild(eyDot2);eyDot3=createDot(3);e.appendChild(eyDot3);eyStroke=createPath("ey-stroke");eyStroke.setAttribute("d"," M "+((eyStrokeWeight+eyDotSpacing)*3)+" "+(eySvgHeight-a/2)+" H "+(b-a/2)+" V "+a/1.5+" L "+a/2+" "+(eyAngleHeight+a/2)+" V "+(c-a-eyDotSpacing));e.appendChild(eyStroke);eyFill=createShape("ey-gradient",eyColor);e.appendChild(eyFill);return e};var animateEyFrame=function(a){var b=0;tl.fromTo(eyDot1,eyDotDuration,{drawSVG:"0"},{drawSVG:"0 "+(b+=(eyStrokeWeight+eyDotSpacing)),ease:Power1.easeInOut,delay:a});tl.fromTo(eyDot2,eyDotDuration,{drawSVG:"0"},{drawSVG:"0 "+(b+=(eyStrokeWeight+eyDotSpacing)),ease:Power1.easeInOut});tl.fromTo(eyDot3,eyDotDuration,{drawSVG:"0"},{drawSVG:"0 "+(b+=(eyStrokeWeight+eyDotSpacing)),ease:Power1.easeInOut});tl.fromTo(eyStroke,eyFrameDuration,{drawSVG:"0"},{drawSVG:"0 100%",ease:Power1.easeIn})};var animateGradient=function(a){tl.fromTo(eyGradient,.5,{opacity:0},{opacity:1,delay:a})};var animateFill=function(a){tl.fromTo(eyFill,.5,{y:eySvgHeight},{y:0,ease:Power2.easeIn,delay:a})};var createPath=function(a){var b=document.createElementNS(svgNS,"path");b.setAttribute("id",a);b.setAttribute("fill","none");b.setAttribute("stroke",eyColor);b.setAttribute("stroke-width",eyStrokeWeight);b.setAttribute("stroke-miterlimit","10");return b};var createDot=function(a){var b=createPath("ey-dot"+a);b.setAttribute("d"," M "+((eyStrokeWeight+eyDotSpacing)*(a-1))+" "+(eySvgHeight-eyStrokeWeight/2)+" h "+eyStrokeWeight);return b};var createShape=function(a,b){var c=document.createElementNS(svgNS,"path");c.setAttribute("id",a);c.setAttribute("fill",b);c.setAttribute("d"," M 0 "+(eySvgHeight)+" H "+(eySvgWidth)+" V 2 "+" L 0 "+(eyAngleHeight+2)+" Z ");return c};var createStop=function(a){var b=document.createElementNS(svgNS,"stop");b.setAttribute("id",a.id);b.setAttribute("offset",a.offset);b.setAttribute("stop-color",a.color);b.setAttribute("stop-opacity",a.opacity);return b};
...\ No newline at end of file ...\ No newline at end of file
...@@ -12,16 +12,15 @@ Requires GSAP TweenMax ...@@ -12,16 +12,15 @@ Requires GSAP TweenMax
12 var tl; 12 var tl;
13 13
14 /** 14 /**
15 svgURL:String - URL to the EY yellow square that will be used for the frame 15 myWeight:Number - the width of the line of the frame in pixels
16 myWidth:Number - width of the desired frame in pixels measured from the outside to the outside 16 myWidth:Number - width of the desired frame in pixels measured from the outside to the outside
17 myHeight:Number - height of the desired frame in pixels measured from the peak to the bottom 17 myHeight:Number - height of the desired frame in pixels measured from the peak to the bottom
18 duration:Number - seconds the animation will take to elapse from start to finish 18 myDuration:Number - seconds the animation will take to elapse from start to finish
19
20 Returns div element containing the EY Div Frame. It will automatically animate in.
19 **/ 21 **/
20 var drawEyDivFrame = function (myWeight, myWidth, myHeight, myDuration) 22 var drawEyDivFrame = function (myWeight, myWidth, myHeight, myDuration)
21 { 23 {
22 //draw first three dots
23 // can I do it with divs?
24
25 tl = new TimelineMax(); 24 tl = new TimelineMax();
26 25
27 var div = document.createElement("div"); 26 var div = document.createElement("div");
...@@ -32,53 +31,85 @@ var drawEyDivFrame = function (myWeight, myWidth, myHeight, myDuration) ...@@ -32,53 +31,85 @@ var drawEyDivFrame = function (myWeight, myWidth, myHeight, myDuration)
32 div.style.overflow = "hidden"; 31 div.style.overflow = "hidden";
33 div.style.left = 10+"px"; 32 div.style.left = 10+"px";
34 div.style.top = 10+"px"; 33 div.style.top = 10+"px";
35 document.body.appendChild(div);
36 34
37 var myColor = "#FFD400"; 35 var myColor = "#FFD400";
38 var dotSpacing = myWeight*5.72/6.72; // EY ratio of weight to spacing 36 var dotSpacing = Math.floor(myWeight*8/10); // EY ratio of weight to spacing
39 var myX = 0; 37 var myX = 0;
40 var myY = 0; 38 var myY = 0;
41 var myRadians = 10 * (Math.PI/180); 39 var myRadians = 10 * Math.PI / 180; // EY angles up at 10 degrees
42 var angleHeight = Math.tan(myRadians)*myWidth - myWeight; 40 var angleHeight = Math.tan(myRadians)*myWidth - myWeight; // height of the shoulder to top of head
43 var myOrigin = "bottom left"; 41 var myOrigin = "bottom left";
44 var myDelay = 0; 42 var myDelay = 0;
43 var myEase = Power1.easeInOut; //ease:Linear.easeNone
45 44
46 //////// calculate the duration of each line 45 //////// calculate the duration of each line
47 var perimeter = (myWidth + myHeight) * 2;
48
49 var myLength = myWeight; 46 var myLength = myWeight;
50 var myDotDuration = myLength*myDuration/perimeter; 47 myDuration = myDuration/2; // want to use half the duration for the dots.
48
49 var dotsCombinedLength = (myWeight + dotSpacing) * 3;
50 var myDotDuration = myLength*myDuration/dotsCombinedLength;
51 var myDotDelay = dotSpacing*myDuration/dotsCombinedLength; // delay after dot is drawn
52
53 var perimeter = (myWidth + myHeight)*2 - angleHeight - myWeight*4 -dotsCombinedLength;
54
55
56
57
51 var dot1 = drawLine({color:myColor, weight:myWeight, fromX:myX, 58 var dot1 = drawLine({color:myColor, weight:myWeight, fromX:myX,
52 fromY:myHeight-myWeight, length:myLength, angle:0, origin:myOrigin, duration:myDotDuration}, div, tl, myDelay); 59 fromY:myHeight-myWeight, length:myLength, angle:0, origin:myOrigin, duration:myDotDuration}, div, tl, myDelay, myEase);
53 var dot2 = drawLine({color:myColor, weight:myWeight, fromX:myX+=(dotSpacing+myWeight), 60 var dot2 = drawLine({color:myColor, weight:myWeight, fromX:myX+=(dotSpacing+myWeight),
54 fromY:myHeight-myWeight, length:myWeight, angle:0, origin:myOrigin, duration:myDotDuration}, div, tl, myDelay); 61 fromY:myHeight-myWeight, length:myLength, angle:0, origin:myOrigin, duration:myDotDuration}, div, tl, myDotDelay, myEase);
55 var dot3 = drawLine({color:myColor, weight:myWeight, fromX:myX+=(dotSpacing+myWeight), 62 var dot3 = drawLine({color:myColor, weight:myWeight, fromX:myX+=(dotSpacing+myWeight),
56 fromY:myHeight-myWeight, length:myWeight, angle:0, origin:myOrigin, duration:myDotDuration}, div, tl, myDelay); 63 fromY:myHeight-myWeight, length:myLength, angle:0, origin:myOrigin, duration:myDotDuration}, div, tl, myDotDelay, myEase);
57 64
65 //tl.addCallback( callback:reversedToDots, position:myDuration, params:[], scope:tl );
66 tl.addCallback( reversedToDots, myDuration+myDotDelay, [], tl );
67
58 myLength = myWidth-myX; 68 myLength = myWidth-myX;
59 var lineBottom = drawLine({color:myColor, weight:myWeight, fromX:myX+=(dotSpacing+myWeight), 69 var lineBottom = drawLine({color:myColor, weight:myWeight, fromX:myX+=(dotSpacing+myWeight),
60 fromY:myHeight-myWeight, length:myLength, angle:0, origin:myOrigin, duration:myLength*myDuration/perimeter}, div, tl, myDelay); 70 fromY:myHeight-myWeight, length:myLength, angle:0, origin:myOrigin, duration:myLength*myDuration/perimeter}, div, tl, myDotDelay, myEase);
61 myLength = myHeight-myWeight*2; 71 myLength = myHeight-myWeight*1.2;
62 var lineRight = drawLine({color:myColor, weight:myWeight, fromX:myWidth, 72 var lineRight = drawLine({color:myColor, weight:myWeight, fromX:myWidth,
63 fromY:myHeight-myWeight*2, length:myLength, angle:-90, origin:myOrigin, duration:myLength*myDuration/perimeter}, div, tl, -myDotDuration*2); 73 fromY:myHeight-myWeight*2, length:myLength, angle:-90, origin:myOrigin, duration:myLength*myDuration/perimeter}, div, tl, myDelay-=myWeight*myDuration/perimeter, myEase);
64 myLength = myWidth+myWeight; 74 myLength = myWidth+myWeight;
65 var lineTop = drawLine({color:myColor, weight:myWeight, fromX:myWidth, 75 var lineTop = drawLine({color:myColor, weight:myWeight, fromX:myWidth,
66 fromY:-myWeight, length:myLength, angle:-190, origin:myOrigin, duration:myLength*myDuration/perimeter}, div, tl, -myDotDuration); 76 fromY:-myWeight, length:myLength, angle:-190, origin:myOrigin, duration:myLength*myDuration/perimeter}, div, tl, myDelay, myEase);
67 myLength = myHeight-angleHeight-myWeight*2-dotSpacing; 77 myLength = myHeight-angleHeight-myWeight*2-dotSpacing;
68 var lineLeft = drawLine({color:myColor, weight:myWeight, fromX:0, 78 var lineLeft = drawLine({color:myColor, weight:myWeight, fromX:0,
69 fromY:angleHeight, length:myLength, angle:-270, origin:myOrigin, duration:myLength*myDuration/perimeter}, div, tl, -myDotDuration); 79 fromY:angleHeight, length:myLength, angle:-270, origin:myOrigin, duration:myLength*myDuration/perimeter}, div, tl, myDelay, myEase);
70 80
81 console.log("drawEyDivFrame total animation time: ", tl.totalDuration() );
71 return div; 82 return div;
72 } 83 }
73 84
85 var reverseDrawEyDivFrame = function ()
86 {
87 return tl.reverse();
88 }
89 var reversedToDots = function (myTimeLine)
90 {
91 if( tl.reversed() )
92 {
93 tl.timeScale(8);
94 };
95 }
96
97
74 /** 98 /**
75 svgURL:String - URL to the EY yellow square that will be used for the frame 99 styleObj:Object - with the following properties
76 myWidth:Number - width of the desired frame in pixels measured from the outside to the outside 100 color:String - CSS colour value as a string "#FFF" or "red" to define the colour of the line
77 myHeight:Number - height of the desired frame in pixels measured from the peak to the bottom 101 weight:Number - Pixels defining the thickness of the line
78 duration:Number - seconds the animation will take to elapse from start to finish 102 fromX:Number - the x position in pixels where this line will start
103 fromY:Number - the y position in pixels where this line will start
104 length:Number - the length of the line in pixels
105 angle:Number - the degrees defines the direction the line will be drawn
106 origin:myOrigin - 0 = right; -90 = up
107 duration:Number - seconds the drawing of this line should take
108 container:HTMLelement - HTML element into which you will draw this element. It should be absolute or relative positioned.
109 timeline:TimelineMax - timeline to which you need this line draw animation added.
110 myDelay:Number - seconds delay from the previous animation before this one starts
79 **/ 111 **/
80 112 var drawLine = function (styleObj, container, timeline, myDelay, myEase)
81 var drawLine = function (styleObj, container, timeline, myDelay)
82 { 113 {
83 var div = document.createElement("div"); 114 var div = document.createElement("div");
84 115
...@@ -107,10 +138,12 @@ var drawLine = function (styleObj, container, timeline, myDelay) ...@@ -107,10 +138,12 @@ var drawLine = function (styleObj, container, timeline, myDelay)
107 div.style.width = "0px"; /////// needs to be 0 before animating to this width 138 div.style.width = "0px"; /////// needs to be 0 before animating to this width
108 139
109 container.appendChild(div); 140 container.appendChild(div);
110 timeline.to(div, styleObj.duration, {width:styleObj.length, ease:Linear.easeNone, delay:myDelay}); 141 timeline.to(div, styleObj.duration, {width:styleObj.length, ease:myEase, delay:myDelay});
111 142
112 return div; 143 return div;
113 } 144 }
114 145
115 //drawEyDivFrame(myWeight, myWidth, myHeight, duration); 146 //drawEyDivFrame(myWeight, myWidth, myHeight, duration);
116 drawEyDivFrame(7, 143, 184, 2); 147 var div = drawEyDivFrame(10, 196, 193, 2);
148 document.body.appendChild(div);
149
......
1 /*!
2 * VERSION: 1.0.1
3 * DATE: 2016-04-28
4 *
5 * Requires:
6 * GSAP TweenMax
7 * GASP drawSVG Plugin ()
8 * This work is subject to the terms at http://greensock.com/standard-license or for
9 * Club GreenSock members, the software agreement that was issued with your membership.
10 *
11 * @license Copyright (c) 2016, Tenzing Communications Inc. All rights reserved.
12 *
13 * @author: Dan Rempel, dan@gotenzing.com
14
15 * Usage Example:
16 * var myEySvg = initEySvgFrame(10, 196, 193); // frame line weight, width, height
17 * document.getElementById("body").appendChild(myEySvg);
18 * animateEyFrame(2); // delay in seconds
19 * animateGradient(2); // delay in seconds
20 * animateFill(2); // delay in seconds
21 *
22 **/
23
24
25 var eySvg;
26 var eyStroke;
27 var eyDot1;
28 var eyDot2;
29 var eyDot3;
30 var eyGradient;
31 var eyFill;
32
33 var tl;
34 var eyStrokeWeight;
35 var eySvgHeight;
36 var eySvgWidth;
37 var eyAngleHeight;
38 var eyDotSpacing;
39 var eyDotDuration = .2; // seconds for animation
40 var eyFrameDuration = 1; // seconds for animation
41 var eyGradientDuration = 1; // seconds for animation
42 var eyFillDuration = 1; // seconds for animation
43 var eyColor = "#FFD400";
44 var svgNS = "http://www.w3.org/2000/svg";
45
46 /**
47 myWeight:Number - the width of the line of the frame in pixels
48 myWidth:Number - width of the desired frame in pixels measured from the outside to the outside
49 myHeight:Number - height of the desired frame in pixels measured from the peak to the bottom
50 myDuration:Number - seconds the animation will take to elapse from start to finish
51
52 Returns: SVG element
53 **/
54 var initEySvgFrame = function (myWeight, myWidth, myHeight)
55 {
56 //// calculate all the points and variables to assist in drawing ////
57
58 tl = new TimelineMax();
59 eyDotSpacing = Math.floor(myWeight*8.5/10); // EY ratio of weight to spacing
60 eyStrokeWeight = myWeight;
61 eySvgWidth = myWidth;
62 eySvgHeight = myHeight;
63
64 var myRadians = 10 * Math.PI / 180; // EY angles up at 10 degrees
65 eyAngleHeight = Math.tan(myRadians)*(myWidth - myWeight); // height of the head (measured vertically from shoulder anchor pt to top of head anchor pt)
66
67 //// create the properly sized svg container ////
68
69 var eySvg = document.createElementNS(svgNS, "svg");
70 eySvg.setAttribute("id", "ey-frame");
71 eySvg.setAttribute("width", myWidth+"px");
72 eySvg.setAttribute("height", myHeight+"px");
73 eySvg.setAttribute("viewBox", "0 0 "+eySvgWidth + " " + eySvgHeight );
74 var myDefs = document.createElementNS(svgNS, "defs");
75 eySvg.appendChild(myDefs);
76
77
78 //// draw the gradient for def ////
79
80 var myLinearGradient = document.createElementNS(svgNS, "linearGradient");
81 myLinearGradient.setAttribute("id", "linear-gradient");
82 myLinearGradient.setAttribute("x1", "0%");
83 myLinearGradient.setAttribute("x2", "0%");
84 myLinearGradient.setAttribute("y1", "0%");
85 myLinearGradient.setAttribute("y2", "100%");
86 myDefs.appendChild(myLinearGradient);
87
88 //stops
89
90 var stop;
91 stop = createStop ({id:"stop-1", offset:"0%", color:"Black", opacity:".7" });
92 myLinearGradient.appendChild(stop);
93 stop = createStop ({id:"stop-2", offset:"100%", color:"Black", opacity:"0" });
94 myLinearGradient.appendChild(stop);
95
96 // gradient shape
97
98 eyGradient = createShape ("ey-gradient", "url(#linear-gradient)");
99 eySvg.appendChild(eyGradient);
100
101
102 //// create 3 dots ////
103
104 eyDot1 = createDot(1);
105 eySvg.appendChild(eyDot1);
106 eyDot2 = createDot(2);
107 eySvg.appendChild(eyDot2);
108 eyDot3 = createDot(3);
109 eySvg.appendChild(eyDot3);
110
111 //// draw the rest of the path ////
112
113 eyStroke = createPath("ey-stroke");
114 eyStroke.setAttribute("d",
115 " M " + ((eyStrokeWeight + eyDotSpacing)*3) + " " + (eySvgHeight-myWeight/2) +
116 " H " + (myWidth-myWeight/2) +
117 " V " + myWeight/1.5 +
118 " L " + myWeight/2 + " " + (eyAngleHeight+myWeight/2) +
119 " V " + (myHeight-myWeight-eyDotSpacing)
120 );
121 eySvg.appendChild(eyStroke);
122
123
124 //// draw the fill shape for def ////
125
126 eyFill = createShape ("ey-gradient", eyColor);
127 eySvg.appendChild(eyFill);
128
129
130 return eySvg;
131
132 };
133
134 var animateEyFrame = function (myDelay)
135 {
136 var lastPt = 0;
137 tl.fromTo(eyDot1, eyDotDuration, {drawSVG:"0"}, {drawSVG:"0 "+(lastPt+=(eyStrokeWeight+eyDotSpacing)), ease:Power1.easeInOut, delay:myDelay });
138 tl.fromTo(eyDot2, eyDotDuration, {drawSVG:"0"}, {drawSVG:"0 "+(lastPt+=(eyStrokeWeight+eyDotSpacing)), ease:Power1.easeInOut });
139 tl.fromTo(eyDot3, eyDotDuration, {drawSVG:"0"}, {drawSVG:"0 "+(lastPt+=(eyStrokeWeight+eyDotSpacing)), ease:Power1.easeInOut });
140 tl.fromTo(eyStroke, eyFrameDuration, {drawSVG:"0"}, {drawSVG:"0 100%", ease:Power1.easeIn});
141 };
142
143 var animateGradient = function (myDelay)
144 {
145 tl.fromTo(eyGradient, .5, {opacity:0}, {opacity:1, delay:myDelay});
146 };
147 var animateFill = function (myDelay)
148 {
149 tl.fromTo(eyFill, .5, {y:eySvgHeight}, {y:0, ease:Power2.easeIn, delay:myDelay});
150 };
151
152
153
154 ////////// private functions
155
156 var createPath = function (myId)
157 {
158 var myPath = document.createElementNS(svgNS,"path");
159 myPath.setAttribute("id", myId);
160 myPath.setAttribute("fill", "none");
161 myPath.setAttribute("stroke", eyColor);
162 myPath.setAttribute("stroke-width", eyStrokeWeight);
163 myPath.setAttribute("stroke-miterlimit", "10");
164 return myPath;
165 };
166
167 var createDot = function (dotNum)
168 {
169 var myDot = createPath("ey-dot"+dotNum);
170 myDot.setAttribute("d",
171 " M " + ((eyStrokeWeight + eyDotSpacing)*(dotNum-1)) + " " + (eySvgHeight-eyStrokeWeight/2) +
172 " h " + eyStrokeWeight
173 );
174 return myDot;
175 };
176
177
178 var createShape = function (myId, myFill)
179 {
180 var myShape = document.createElementNS(svgNS,"path");
181 myShape.setAttribute("id", myId);
182 myShape.setAttribute("fill", myFill);
183 myShape.setAttribute("d",
184 " M 0 " + (eySvgHeight) +
185 " H " + (eySvgWidth) +
186 " V 2 " +
187 " L 0 " + (eyAngleHeight+2) +
188 " Z "
189 );
190 return myShape;
191 };
192
193 var createStop = function (myStopObj)
194 {
195 var myStop = document.createElementNS(svgNS, "stop");
196 myStop.setAttribute("id", myStopObj.id);
197 myStop.setAttribute("offset", myStopObj.offset);
198 myStop.setAttribute("stop-color", myStopObj.color);
199 myStop.setAttribute("stop-opacity", myStopObj.opacity);
200 return myStop;
201 };
202
203
204
205