Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var scroller = {
- frame: 0,
- frame2: 0.1,
- amplitude1: 10,
- offset: 0.2,
- sinescroll: function(target){
- scrolltext = $(target).text();
- $(target).text("");
- // write DIVs to hold characters
- for (var i = 0; i < scrolltext.length; i++)
- {
- var appendText = scrolltext[i];
- if(scrolltext[i] == " "){
- appendText = " ";
- }
- $(target).append('<div class="scroller_sub" id="scroller_sub_'+i+'">'+appendText+'</div>');
- //position everything correctly
- var last_left = 0;
- $('.scroller_sub').each(function(){
- $(this).css('left', last_left);
- last_left += $(this).width();
- }).css({position:'absolute', top:'0px'});
- }
- },
- step: function(){
- var angle = this.frame;
- var offset = this.offset;
- var amplitude1 = this.amplitude1;
- $('.scroller_sub').each(function(){
- var top = amplitude1 * Math.sin(angle);
- $(this).css('top', top);
- angle += offset;
- });
- this.frame += this.frame2;
- }
- };
Add Comment
Please, Sign In to add comment