jquery Programming Glossary: math.cos
Dynamically arrange some elements around a circle http://stackoverflow.com/questions/10152390/dynamically-arrange-some-elements-around-a-circle i 0 i numElements.length i var x container_width 2 radius Math.cos angle var y container_height 2 radius Math.sin angle angle step.. fields.each function var x Math.round width 2 radius Math.cos angle this .width 2 y Math.round height 2 radius Math.sin angle..
jQuery rounded slider http://stackoverflow.com/questions/10186135/jquery-rounded-slider radius Math.sin deg Math.PI 180 Y Math.round radius Math.cos deg Math.PI 180 slider.css left X radius sliderW2 top Y radius.. radius Math.sin deg Math.PI 180 Y Math.round radius Math.cos deg Math.PI 180 ...and use X and Y to set the element css positions...
How to create an orbit of three elements around a logo http://stackoverflow.com/questions/10294720/how-to-create-an-orbit-of-three-elements-around-a-logo Math.sin angle Math.PI 180.0 var l o.left distance Math.cos angle Math.PI 180.0 '#b' .css top t left l '#c' .css top t..
Programatically set the marker on a plot http://stackoverflow.com/questions/10415683/programatically-set-the-marker-on-a-plot cosPoints for var i 0 i 2 Math.PI i 0.4 cosPoints.push i Math.cos i var plot3 .jqplot 'chartdiv' cosPoints highlighter show..
How to create circular animation with different objects using JQUERY http://stackoverflow.com/questions/15947070/how-to-create-circular-animation-with-different-objects-using-jquery idx val var rad angles idx Math.PI 180 val .css left 550 Math.cos rad unit 'px' top unit 1 Math.sin rad 'px' angles idx var..
Looking for jQuery easing functions without using a plugin http://stackoverflow.com/questions/5207301/looking-for-jquery-easing-functions-without-using-a-plugin c 2 t 2 t t t t 2 b easeInSine function x t b c d return c Math.cos t d Math.PI 2 c b easeOutSine function x t b c d return c Math.sin.. d Math.PI 2 b easeInOutSine function x t b c d return c 2 Math.cos Math.PI t d 1 b easeInExpo function x t b c d return t 0 b c..
jQuery plugin to make an element orbit another? [closed] http://stackoverflow.com/questions/7454667/jquery-plugin-to-make-an-element-orbit-another for the orbiting element var w theta iter delta var a r Math.cos w var o r Math.sin w var x parseInt s.css 'left' s.height..
width/height after transform http://stackoverflow.com/questions/7565542/width-height-after-transform solution var rotationAngle var x '#box' .width Math.cos rotationAngle '#box' .height Math.sin rotationAngle share..
raphael.js - converting pie graph to donut graph http://stackoverflow.com/questions/7972347/raphael-js-converting-pie-graph-to-donut-graph endAngle params console.log params.fill var x1 cx r Math.cos startAngle rad x2 cx r Math.cos endAngle rad y1 cy r Math.sin.. params.fill var x1 cx r Math.cos startAngle rad x2 cx r Math.cos endAngle rad y1 cy r Math.sin startAngle rad y2 cy r Math.sin.. call the coordinates of this point xx1 and yy1 xx1 cx rin Math.cos startAngle rad yy1 cy rin Math.sin startAngle rad Yous start..
Javascript/css in IE8 http://stackoverflow.com/questions/9911443/javascript-css-in-ie8 srotate rotate sdegree deg var rad Math.PI 180 sdegree cos Math.cos rad sin Math.sin rad jQuery _this .find .sec .css moz transform.. hrotate rotate hdegree deg var rad Math.PI 180 hdegree cos Math.cos rad sin Math.sin rad jQuery _this .find .hour .css moz transform.. mrotate rotate mdegree deg var rad Math.PI 180 mdegree cos Math.cos rad sin Math.sin rad jQuery _this .find .min .css moz transform..
Dynamically arrange some elements around a circle http://stackoverflow.com/questions/10152390/dynamically-arrange-some-elements-around-a-circle var numElements 4 angle 0 step 2 Math.PI numElements for var i 0 i numElements.length i var x container_width 2 radius Math.cos angle var y container_height 2 radius Math.sin angle angle step It is not complete but should give you a good start. Update.. height container.height angle 0 step 2 Math.PI fields.length fields.each function var x Math.round width 2 radius Math.cos angle this .width 2 y Math.round height 2 radius Math.sin angle this .height 2 this .css left x 'px' top y 'px' angle step..
jQuery rounded slider http://stackoverflow.com/questions/10186135/jquery-rounded-slider final 0 360 positive degrees from mouse position X Math.round radius Math.sin deg Math.PI 180 Y Math.round radius Math.cos deg Math.PI 180 slider.css left X radius sliderW2 top Y radius sliderH2 AND FINALLY apply exact degrees to ball rotation..
How to create an orbit of three elements around a logo http://stackoverflow.com/questions/10294720/how-to-create-an-orbit-of-three-elements-around-a-logo rate in ms function f var o '#a' .offset var t o.top distance Math.sin angle Math.PI 180.0 var l o.left distance Math.cos angle Math.PI 180.0 '#b' .css top t left l '#c' .css top t 20 left l 30 '#d' .css top t 40 left l 40 angle speed rate..
Programatically set the marker on a plot http://stackoverflow.com/questions/10415683/programatically-set-the-marker-on-a-plot function Some simple loops to build up data arrays. var cosPoints for var i 0 i 2 Math.PI i 0.4 cosPoints.push i Math.cos i var plot3 .jqplot 'chartdiv' cosPoints highlighter show true showTooltip true tooltipLocation 'ne' tooltipAxes..
How to create circular animation with different objects using JQUERY http://stackoverflow.com/questions/15947070/how-to-create-circular-animation-with-different-objects-using-jquery 135 var unit 215 var animate function .each '.box' function idx val var rad angles idx Math.PI 180 val .css left 550 Math.cos rad unit 'px' top unit 1 Math.sin rad 'px' angles idx var timer setInterval animate 10 You have to change the left top..
Looking for jQuery easing functions without using a plugin http://stackoverflow.com/questions/5207301/looking-for-jquery-easing-functions-without-using-a-plugin function x t b c d if t d 2 1 return c 2 t t t t t b return c 2 t 2 t t t t 2 b easeInSine function x t b c d return c Math.cos t d Math.PI 2 c b easeOutSine function x t b c d return c Math.sin t d Math.PI 2 b easeInOutSine function x t b c d return.. 2 c b easeOutSine function x t b c d return c Math.sin t d Math.PI 2 b easeInOutSine function x t b c d return c 2 Math.cos Math.PI t d 1 b easeInExpo function x t b c d return t 0 b c Math.pow 2 10 t d 1 b easeOutExpo function x t b c d return..
jQuery plugin to make an element orbit another? [closed] http://stackoverflow.com/questions/7454667/jquery-plugin-to-make-an-element-orbit-another settings setTimeout function Calculate the new position for the orbiting element var w theta iter delta var a r Math.cos w var o r Math.sin w var x parseInt s.css 'left' s.height 2 a var y parseInt s.css 'top' s.width 2 o Set the CSS properties..
width/height after transform http://stackoverflow.com/questions/7565542/width-height-after-transform
raphael.js - converting pie graph to donut graph http://stackoverflow.com/questions/7972347/raphael-js-converting-pie-graph-to-donut-graph created with the following code function sector cx cy r startAngle endAngle params console.log params.fill var x1 cx r Math.cos startAngle rad x2 cx r Math.cos endAngle rad y1 cy r Math.sin startAngle rad y2 cy r Math.sin endAngle rad return paper.path.. function sector cx cy r startAngle endAngle params console.log params.fill var x1 cx r Math.cos startAngle rad x2 cx r Math.cos endAngle rad y1 cy r Math.sin startAngle rad y2 cy r Math.sin endAngle rad return paper.path M cx cy L x1 y1 A r r 0 endAngle.. be in the middle of the donut with the radius rin . Lets call the coordinates of this point xx1 and yy1 xx1 cx rin Math.cos startAngle rad yy1 cy rin Math.sin startAngle rad Yous start building the path from this point M xx1 yy1 Next step is to..
Javascript/css in IE8 http://stackoverflow.com/questions/9911443/javascript-css-in-ie8 if opts.type 'analog' var sdegree seconds 6 var srotate rotate sdegree deg var rad Math.PI 180 sdegree cos Math.cos rad sin Math.sin rad jQuery _this .find .sec .css moz transform srotate webkit transform srotate ms transform srotate .. if opts.type 'analog' var hdegree hours 30 mins 2 var hrotate rotate hdegree deg var rad Math.PI 180 hdegree cos Math.cos rad sin Math.sin rad jQuery _this .find .hour .css moz transform hrotate webkit transform hrotate ms transform hrotate .. .getMinutes if opts.type 'analog' var mdegree mins 6 var mrotate rotate mdegree deg var rad Math.PI 180 mdegree cos Math.cos rad sin Math.sin rad jQuery _this .find .min .css moz transform mrotate webkit transform mrotate ms transform mrotate ..
|