Jump to content

Search the Community

Showing results for tags 'sprite'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 5 results

  1. I want to use a gif I made for my sprite (it would be nice if the gif only played when the character moved) So far, I have a rectangle with choppy character movements. (It would also be nice if I could make the character movement smoother. I watched tons of tutorials but I couldn't find anything that shows how to do what I want to do. Here is the code <!DOCTYPE html> <html> <head> <style type="text/css"> #backgroundColor { width: 100px; height: 100px; background-color: white; animation-name: backgroundChange; animation-duration: 45s; animation-iteration-count: infinite; } @keyframes backgroundChange { 0% {background-color: white;} 3.3% {background-color: #ffc5c5;} 6.6% {background-color: #f78a8a;} 10% {background-color: #f95d5d;} 13.3% {background-color: #f73737;} 16.6% {background-color: red;} 20% {background-color: #b70303;} 23.3% {background-color: #8c0202;} 26.6% {background-color: #5a0202;} 30% {background-color: #310101;} 33.3% {background-color: black;} 36.6% {background-color: #292929;} 40% {background-color: #3c3c3c;} 43.3% {background-color: #757575;} 46.6% {background-color: #d0d0d0;} 50% {background-color: white;} 53.3% {background-color: #ffc5c5;} 56.6% {background-color: #f78a8a;} 60% {background-color: #f95d5d;} 63.6% {background-color: #f73737;} 66.6% {background-color: red;} 70% {background-color: #b70303;} 73.3% {background-color: #8c0202;} 76.6% {background-color: #5a0202;} 80% {background-color: #310101;} 83% {background-color: black;} 86.6% {background-color: #292929;} 90% {background-color: #3c3c3c;} 93.3% {background-color: #757575;} 96% {background-color: #d0d0d0;} 100% {background-color: white;} } #canvas{ height: 540px; width: 6350px; position:absolute; top:50%; left:52%; transform: translate(-50%,-50%); box-shadow: 0 0 16px 2px rgba(0,0,0,0.4); background-color: #FFF; } </style> <title>Bermuda Triangle</title> </head> <body id="backgroundColor"> <img id="character" style="height: 40px; width: 40px;" src="https://piskel-imgstore-b.appspot.com/img/9478ea0f-79c8-11e8-b58c-67762e4a73c8.gif"> <canvas id='canvas' style="background-image:url(https://preview.ibb.co/fEanjo/realroom.jpg); height: 540px; width: 635px;"></canvas> <script> var canvas = document.querySelector('#canvas'); var context = canvas.getContext('2d'); var xPos = 0; var yPos= 0; context.rect(xPos, yPos, 40, 40); context.stroke(); function move(e) { //alert(e.keyCode); if(e.keyCode==83){ yPos+=10; } if(e.keyCode==87){ yPos-=10; } if(e.keyCode==65){ xPos-=10; } if(e.keyCode==68){ xPos+=10; } canvas.width=canvas.width; context.rect(xPos, yPos, 40, 40); context.stroke(); } document.onkeydown = move; </script> </body> </html>
  2. I'm trying to use a sprite for the first time, and I've done something wrong. <head> <style type="text/css">.csstest a{display: block;width: 500px;height: 750px;background: url(http://www.littlevictorian.com/wp-content/uploads/2013/11/SofaRolloverSprite.png);background-position: 0 0;}.csstest a:hover {background-position: -500px 0;} </style></head> <body><div class="csstest"><a href="http://www.littlevictorian.com/?p=1180"></a></div></body> Could someone please let me know what I'm doing wrong? Thanks!
  3. EDIT: i found out myself, sorry for a empty post! ..
  4. Pretty straight forward question I think... I'm redesigning my website buttons to use an image sprite. I can get them to display the normal image from the sprite, as well as the :hover image, but I'm having no luck finding a way to get the button to change appearance when you click on the button (not in the new page, but the actual "onclick"). Is this even possible with an image sprite and CSS or would I need to implement something else? I've found absolutely nothing on the internets related to this. Thanks!
  5. I have created a css sprite based navigation. The navigation looks fine if I order the navigation items in the same order as they are in the .gif file and the CSS definitions, but if I rearrange them, something strange is happening to the image, and I'm not sure what. Here are three examples: 1. All the LI items in the same order as the .gif and CSS definition. http://www.reneebull...navigation.html (Note the top link "One" is a different color becuase it is stled as "current") Everthing is fine here.2. LI items two and three are rearranged, notice how the image for two and three are distorted somehow. http://www.reneebull...avigation2.html3. LI item two is omitted, so now the images for three, four, five, and six are distorted: http://www.reneebull...avigation3.html Source Code Example 1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><style type="text/css"> /* Needed to remove Tab/Indent from Unorderd Navigation List */li {margin: 0px;padding: 0px;}ul {margin: 0px;padding: 0px;}/* Needed to remove Tab/Indent from Unorderd Navigation List */ #mainNav {float: left;width: 160px;background: url(navigation.gif) no-repeat scroll left top;} #mainNav li { list-style: none; }#mainNav li a { width: 160px; display: block; }#mainNav ul li#navOne a, #mainNav ul li#navTwo a, #mainNav ul li#navThree a, #mainNav ul li#navFour a,#mainNav ul li#navFive a, #mainNav ul li#navSix a {background-image: url(navigation.gif) ;background-repeat: no-repeat;padding: 0px;text-indent: -9000px;border-style: none;width: 160px;overflow: hidden;} #mainNav ul li#navOne { background-position: 0px 0px; }#mainNav ul li#navOne a { height: 34px; background-position: 0px 0px }#mainNav ul li#navOne a:hover, #mainNav ul li#navOne a.current { background-position: -160px 0px; }#mainNav ul li#navTwo { background-position: 0px -60px; }#mainNav ul li#navTwo a { height: 34px; background-position: 0px -34px; }#mainNav ul li#navTwo a:hover, #mainNav ul li#navTwo a.current { background-position: -160px -34px; }#mainNav ul li#navThree { background-position: 0px -68px; }#mainNav ul li#navThree a { height: 34px; background-position: 0px -68px; }#mainNav ul li#navThree a:hover, #mainNav ul li#navThree a.current { background-position: -160px -68px; }#mainNav ul li#navFour { background-position: 0px -102px; }#mainNav ul li#navFour a { height: 34px; background-position: 0px -102px; }#mainNav ul li#navFour a:hover, #mainNav ul li#navFour a.current { background-position: -160px -102px; }#mainNav ul li#navFive { background-position: 0px -136px; }#mainNav ul li#navFive a { height: 34px; background-position: 0px -136px; }#mainNav ul li#navFive a:hover, #mainNav ul li#navFive a.current { background-position: -160px -136px; }#mainNav ul li#navSix { background-position: 0px -170px; }#mainNav ul li#navSix a { height: 34px; background-position: 0px -170px; }#mainNav ul li#navSix a:hover, #mainNav ul li#navSix a.current { background-position: -160px -170px; } </style></head><body><DIV id="mainNav"><UL> <LI id=navOne><A class="current" href="#">One</A></LI> <LI id=navTwo><A class="" href="#">Two</A></LI> <LI id=navThree><A class="" href="#">Three</A></LI> <LI id=navFour><A class="" href="#">Four</A></LI> <LI id=navFive><A class="" href="#">Five</A></LI> <LI id=navSix><A class="" href="#">Six</A></LI></UL></DIV></body></html> Source Code Example 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><style type="text/css"> /* Needed to remove Tab/Indent from Unorderd Navigation List */li {margin: 0px;padding: 0px;}ul {margin: 0px;padding: 0px;}/* Needed to remove Tab/Indent from Unorderd Navigation List */ #mainNav {float: left;width: 160px;background: url(navigation.gif) no-repeat scroll left top;} #mainNav li { list-style: none; }#mainNav li a { width: 160px; display: block; }#mainNav ul li#navOne a, #mainNav ul li#navTwo a, #mainNav ul li#navThree a, #mainNav ul li#navFour a,#mainNav ul li#navFive a, #mainNav ul li#navSix a {background-image: url(navigation.gif) ;background-repeat: no-repeat;padding: 0px;text-indent: -9000px;border-style: none;width: 160px;overflow: hidden;} #mainNav ul li#navOne { background-position: 0px 0px; }#mainNav ul li#navOne a { height: 34px; background-position: 0px 0px }#mainNav ul li#navOne a:hover, #mainNav ul li#navOne a.current { background-position: -160px 0px; }#mainNav ul li#navTwo { background-position: 0px -60px; }#mainNav ul li#navTwo a { height: 34px; background-position: 0px -34px; }#mainNav ul li#navTwo a:hover, #mainNav ul li#navTwo a.current { background-position: -160px -34px; }#mainNav ul li#navThree { background-position: 0px -68px; }#mainNav ul li#navThree a { height: 34px; background-position: 0px -68px; }#mainNav ul li#navThree a:hover, #mainNav ul li#navThree a.current { background-position: -160px -68px; }#mainNav ul li#navFour { background-position: 0px -102px; }#mainNav ul li#navFour a { height: 34px; background-position: 0px -102px; }#mainNav ul li#navFour a:hover, #mainNav ul li#navFour a.current { background-position: -160px -102px; }#mainNav ul li#navFive { background-position: 0px -136px; }#mainNav ul li#navFive a { height: 34px; background-position: 0px -136px; }#mainNav ul li#navFive a:hover, #mainNav ul li#navFive a.current { background-position: -160px -136px; }#mainNav ul li#navSix { background-position: 0px -170px; }#mainNav ul li#navSix a { height: 34px; background-position: 0px -170px; }#mainNav ul li#navSix a:hover, #mainNav ul li#navSix a.current { background-position: -160px -170px; } </style></head><body><DIV id="mainNav"><UL> <LI id=navOne><A class="current" href="#">One</A></LI> <!-- LI id=navTwo and Three are switched --> <LI id=navThree><A class="" href="#">Two</A></LI> <LI id=navTwo><A class="" href="#">Three</A></LI> <LI id=navFour><A class="" href="#">Four</A></LI> <LI id=navFive><A class="" href="#">Five</A></LI> <LI id=navSix><A class="" href="#">Six</A></LI></UL></DIV></body></html> Source Code Example 3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><style type="text/css"> /* Needed to remove Tab/Indent from Unorderd Navigation List */li {margin: 0px;padding: 0px;}ul {margin: 0px;padding: 0px;}/* Needed to remove Tab/Indent from Unorderd Navigation List */ #mainNav {float: left;width: 160px;background: url(navigation.gif) no-repeat scroll left top;} #mainNav li { list-style: none; }#mainNav li a { width: 160px; display: block; }#mainNav ul li#navOne a, #mainNav ul li#navTwo a, #mainNav ul li#navThree a, #mainNav ul li#navFour a,#mainNav ul li#navFive a, #mainNav ul li#navSix a {background-image: url(navigation.gif) ;background-repeat: no-repeat;padding: 0px;text-indent: -9000px;border-style: none;width: 160px;overflow: hidden;} #mainNav ul li#navOne { background-position: 0px 0px; }#mainNav ul li#navOne a { height: 34px; background-position: 0px 0px }#mainNav ul li#navOne a:hover, #mainNav ul li#navOne a.current { background-position: -160px 0px; }#mainNav ul li#navTwo { background-position: 0px -60px; }#mainNav ul li#navTwo a { height: 34px; background-position: 0px -34px; }#mainNav ul li#navTwo a:hover, #mainNav ul li#navTwo a.current { background-position: -160px -34px; }#mainNav ul li#navThree { background-position: 0px -68px; }#mainNav ul li#navThree a { height: 34px; background-position: 0px -68px; }#mainNav ul li#navThree a:hover, #mainNav ul li#navThree a.current { background-position: -160px -68px; }#mainNav ul li#navFour { background-position: 0px -102px; }#mainNav ul li#navFour a { height: 34px; background-position: 0px -102px; }#mainNav ul li#navFour a:hover, #mainNav ul li#navFour a.current { background-position: -160px -102px; }#mainNav ul li#navFive { background-position: 0px -136px; }#mainNav ul li#navFive a { height: 34px; background-position: 0px -136px; }#mainNav ul li#navFive a:hover, #mainNav ul li#navFive a.current { background-position: -160px -136px; }#mainNav ul li#navSix { background-position: 0px -170px; }#mainNav ul li#navSix a { height: 34px; background-position: 0px -170px; }#mainNav ul li#navSix a:hover, #mainNav ul li#navSix a.current { background-position: -160px -170px; } </style></head><body><DIV id="mainNav"><UL> <LI id=navOne><A class="current" href="#">One</A></LI> <!-- LI id=navTwo is removed --> <LI id=navThree><A class="" href="#">Three</A></LI> <LI id=navFour><A class="" href="#">Four</A></LI> <LI id=navFive><A class="" href="#">Five</A></LI> <LI id=navSix><A class="" href="#">Six</A></LI></UL></DIV></body></html>
×
×
  • Create New...