HTML code for 'Rotational Effect to Wheel'

HTML code for 'Rotational Effect to Wheel'

Ravi Vare發表於
Number of replies: 10
Hi Everybody,
 
I have image on front page of website.
It is Wheel.( It is called as 'Wheel of Sun' in India)-Plz. See attachment
I want to give 'Rotation Effect' to it.
I searched at google. I didn't get exact information.
 
 
HTML Code for It?
 
Best Regards,
Ravi
附件 logo.jpg
評比平均分數: -
In reply to Ravi Vare

Re: HTML code for 'Rotational Effect to Wheel'

Mauno Korpelainen發表於

Ravi, this is not exactly a moodle issue... but usually people use gif animations for such things - you just need to have some image / animation editor program (offline) or some online editor like http://www.lunapic.com/editor/ (these examples were made with animation "spin blur"  in lunapic editor toolbar)

Then you need to know what kind of effects you actually need, how many animated frames with some delay and what size / transition etc you want to use.

For example

animation 1

might be too big size and you could resize it smaller - for example animation 2

Try to search something like "how to create gif animations?"

And remember that some people may not like at all infinitely repeated animations... 眨眼

評比平均分數:Useful (1)
In reply to Ravi Vare

Re: HTML code for 'Rotational Effect to Wheel'

Mary Evans發表於

You could try using CSS3 transforms

http://davidwalsh.name/css-spin-revisited

I tested it out and got it to work using a smaller image, which is a cutdown version of yours, but I made it into a transparent png.

I have attached the HTML + CSS to this comment.

To test it you need to have the image and the html file in the same directory.

Wheel animation

評比平均分數:Useful (2)
In reply to Mary Evans

Re: HTML code for 'Rotational Effect to Wheel'

Mauno Korpelainen發表於

I really love this kind of examples - Thank You Mary!

This spin animation css does not seem to work in IE7 - IE9 and Opera (before version 12?) but after some years these css3 tricks are certainly going to make our web pages smoother and faster to use 微笑

http://caniuse.com/#feat=css-animation

評比平均分數:Useful (1)
In reply to Mauno Korpelainen

Re: HTML code for 'Rotational Effect to Wheel'

Mary Evans發表於

Hi Mauno,

I just wish all the Modern Browsers were all singing off the same hymn sheet as styling the same thing in slightly different code is a pain!

Thanks for the Can I Use link...very useful! I wondered why it wasn't working in IE9 and Opera - I need to update my browsers! 微笑

Cheers

Mary

In reply to Mary Evans

Re: HTML code for 'Rotational Effect to Wheel'

Ravi Vare發表於

Discussion with you people is always informative !!!微笑

Thanks Mary & Mauno.

My Query is very basic. Sorry酷

How to embed Code (given by Mary) in HTML editor in Moodle?

I am going to use this Logo-Wheel on front page (in Topic Section / Site News).

Plz. just give Clue.

Thanks again.

Ravi

In reply to Ravi Vare

Re: HTML code for 'Rotational Effect to Wheel'

Mary Evans發表於

Depending on the theme, this is one way you can do this.

  1. First you need to add the container to hold the wheel in place. So enable Edit settings in Front page, and then Edit the Site Topic area and ADD the following into the HTML part of the editor.
    <div id="box">
    <div id="wheel"></div>
    </div>

  2. Next use the ADD BLOCK to create a HTML block
  3. Edit this new block and add the wheel.png save and close the block
  4. Next open the block again and then click on the HTML editor section
    where you should be able to see the code for the image. Hightlight and copy and paste the URL for the image into Notepad and save it for later. Close the Block again.
  5. Next copy and paste this CSS to Notepad and save it for later, but don't forget to add the image URL (where highlighted) in this CSS ... (the example URL highlighted in yellow, is the one I used while testing this tutorial, and is therefores, only relevent only to my localhost server, but yours should look something similar)

        <style type="text/css">

        #box {
          position: relative;
          width: 400px;
          height: 400px;
          margin: 150px auto;
    }
        #wheel  { /* with animation properties */
          background: url(http://localhost/moodle/draftfile.php/5/user/draft/750396728/logo.png) 0 0 no-repeat;
          position: absolute;
          top: -100px;
          left: -100px;
          width: 400px;
          height: 400px;

          -webkit-animation-name: spin;
          -webkit-animation-duration: 40000ms; /* 40 seconds */
          -webkit-animation-iteration-count: infinite;
          -webkit-animation-timing-function: linear;

          /* mozilla ff */
          -moz-animation-name: spin;
          -moz-animation-duration: 40000ms; /* 40 seconds */
          -moz-animation-iteration-count: infinite;
          -moz-animation-timing-function: linear;

          /* microsoft ie */
          -ms-animation-name: spin;
          -ms-animation-duration: 40000ms; /* 40 seconds */
          -ms-animation-iteration-count: infinite;
          -ms-animation-timing-function: linear;

    }

    @-webkit-keyframes spin {
      from { -webkit-transform: rotate(0deg); }
      to { -webkit-transform: rotate(360deg); }
    }

    @-moz-keyframes spin {
      from { -moz-transform: rotate(0deg); }
      to { -moz-transform: rotate(360deg); }
    }

    @-ms-keyframes spin {
      from { -ms-transform: rotate(0deg); }
      to { -ms-transform: rotate(360deg); }
    }
    </style>

  6. Next all depends on your theme. If there is a Custom CSS Settings page you can add the CSS there, but without the <style></style> tags.
  7. Or if your theme has no Custom CSS settings page then add all of the code as previously shown above, with style tags included, and paste into the HEAD section of...
    Site Administration > Appearance > Additional HTML
    Then SAVE it.

Check out your frontpage and you should see the wheel.

Hope this works as it did in my test today.

Cheers

Mary

PS: I forgot to say you can safely remove the HTML code from the HTML block, by going into the block when editing and open the HTML section then just copy and delete the code.
 And then save just adding a simple word like image.
 Save and then you can hide this block, until you need to add another image someother time.

Mary

 

 

In reply to Mary Evans

Re: HTML code for 'Rotational Effect to Wheel'

Ravi Vare發表於

Thanks a lot, Mary.

I am using Moodle 2.2.4+ (Build: 20120712) & Standard theme.

I am trying different way.

I followed you. but i got blank Area at Topic section on front page.

PC became very slow. Something is going wrong.

 

Mauno's idea is nice. but we can't control speed of wheel.

I am using GIMP. But yet i don't get exact solution.

Thanks again.

Ravi

In reply to Ravi Vare

Re: HTML code for 'Rotational Effect to Wheel'

Mary Evans發表於

You must have done something wrong then as I got it to work OK.

In reply to Mary Evans

Re: HTML code for 'Rotational Effect to Wheel'

Ravi Vare發表於

Hi Mary, it works !!! Thanks.微笑

But stil there are some issues.

Let me try 酷

Best Regards,

Ravi