jquery Programming Glossary: math.sin
Dynamically arrange some elements around a circle http://stackoverflow.com/questions/10152390/dynamically-arrange-some-elements-around-a-circle 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.. 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..
jQuery rounded slider http://stackoverflow.com/questions/10186135/jquery-rounded-slider 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.. from a mouse position just do X Math.round radius Math.sin deg Math.PI 180 Y Math.round radius Math.cos deg Math.PI 180..
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 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..
Looking for jQuery easing functions without using a plugin http://stackoverflow.com/questions/5207301/looking-for-jquery-easing-functions-without-using-a-plugin 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 c 2.. var s p 2 Math.PI Math.asin c a return a Math.pow 2 10 t 1 Math.sin t d s 2 Math.PI p b easeOutElastic function x t b c d var s.. var s p 2 Math.PI Math.asin c a return a Math.pow 2 10 t Math.sin t d s 2 Math.PI p c b easeInOutElastic function x t b c d var..
jQuery plugin to make an element orbit another? [closed] http://stackoverflow.com/questions/7454667/jquery-plugin-to-make-an-element-orbit-another 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..
width/height after transform http://stackoverflow.com/questions/7565542/width-height-after-transform
jQuery animating along a sine wave http://stackoverflow.com/questions/7802243/jquery-animating-along-a-sine-wave .top var SineWave function this.css function p var s Math.sin Math.abs p 1 10 if dir flip the sin wave to continue traversing.. window.SineWave SineWave function this.css function p s Math.sin p 1 500 1 x 5000 p 5000 10 2 y s 100 150 return top y px left..
raphael.js - converting pie graph to donut graph http://stackoverflow.com/questions/7972347/raphael-js-converting-pie-graph-to-donut-graph 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.. 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.. 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..
What is an easing function? http://stackoverflow.com/questions/8316882/what-is-an-easing-function var s p 2 Math.PI Math.asin c a return a Math.pow 2 10 t 1 Math.sin t d s 2 Math.PI p b Perhaps somebody else can explain the actual..
Javascript/css in IE8 http://stackoverflow.com/questions/9911443/javascript-css-in-ie8 deg var rad Math.PI 180 sdegree cos Math.cos rad sin Math.sin rad jQuery _this .find .sec .css moz transform srotate webkit.. deg var rad Math.PI 180 hdegree cos Math.cos rad sin Math.sin rad jQuery _this .find .hour .css moz transform hrotate webkit.. deg var rad Math.PI 180 mdegree cos Math.cos rad sin Math.sin rad jQuery _this .find .min .css moz transform mrotate webkit..
Dynamically arrange some elements around a circle http://stackoverflow.com/questions/10152390/dynamically-arrange-some-elements-around-a-circle 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 Here's something that actually works var radius.. 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 Demo http jsfiddle.net ThiefMaster LPh33 Here's an improved..
jQuery rounded slider http://stackoverflow.com/questions/10186135/jquery-rounded-slider radius mPos.y radius deg atan Math.PI 180 180 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 .. around degrees 0 360 To translate back the degrees we calculated from a mouse position just do X Math.round 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. share..
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 .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 width height properties of boxes..
Looking for jQuery easing functions without using a plugin http://stackoverflow.com/questions/5207301/looking-for-jquery-easing-functions-without-using-a-plugin 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 c 2 Math.cos Math.PI t d 1 b easeInExpo function x t b c d return.. 1 return b c if p p d .3 if a Math.abs c a c var s p 4 else var s p 2 Math.PI Math.asin c a return a Math.pow 2 10 t 1 Math.sin t d s 2 Math.PI p b easeOutElastic function x t b c d var s 1.70158 var p 0 var a c if t 0 return b if t d 1 return b c.. d 1 return b c if p p d .3 if a Math.abs c a c var s p 4 else var s p 2 Math.PI Math.asin c a return a Math.pow 2 10 t Math.sin t d s 2 Math.PI p c b easeInOutElastic function x t b c d var s 1.70158 var p 0 var a c if t 0 return b if t d 2 2 return..
jQuery plugin to make an element orbit another? [closed] http://stackoverflow.com/questions/7454667/jquery-plugin-to-make-an-element-orbit-another 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 top and left..
width/height after transform http://stackoverflow.com/questions/7565542/width-height-after-transform
jQuery animating along a sine wave http://stackoverflow.com/questions/7802243/jquery-animating-along-a-sine-wave dir var x_current div .offset .left var y_current div .offset .top var SineWave function this.css function p var s Math.sin Math.abs p 1 10 if dir flip the sin wave to continue traversing s s var x 300 p 300 var y s 100 150 var o s 2 4 0.1 opacity.. these specific lines you can make it as infinite as you need. window.SineWave SineWave function this.css function p s Math.sin p 1 500 1 x 5000 p 5000 10 2 y s 100 150 return top y px left x px #nyan .stop .animate path new SineWave 50000 3 linear..
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 startAngle rad y2 cy r Math.sin endAngle rad return paper.path M cx cy L x1 y1 A r r 0 endAngle startAngle 180 0 x2 y2 z.. 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 startAngle 180 0 x2 y2 z .attr params How would I modify.. 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 draw the line to the edge of the circle..
What is an easing function? http://stackoverflow.com/questions/8316882/what-is-an-easing-function 1 return b c if p p d .3 if a Math.abs c a c var s p 4 else var s p 2 Math.PI Math.asin c a return a Math.pow 2 10 t 1 Math.sin t d s 2 Math.PI p b Perhaps somebody else can explain the actual math part behind the interpolation because honestly I'm..
Javascript/css in IE8 http://stackoverflow.com/questions/9911443/javascript-css-in-ie8 '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 'filter' progid DXImageTransform.Microsoft.Matrix.. '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 'filter' progid.. 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 'filter' progid DXImageTransform.Microsoft.Matrix..
|