Jump to content

Search the Community

Showing results for tags 'animate'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

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


Age


Donation Link

Found 3 results

  1. I am trying to solve this puzzle in PHP. I have found lots of help in Java and C++, but that isn't helping. I have gotten my code to spit out the first line, but am not sure how to get it to continue until all the particles have cleared the string. Any help would be appreciated! Problem Statement A collection of particles is contained in a linear chamber. They all have the same speed, but some are headed toward the right and others are headed toward the left. These particles can pass through each other without disturbing the motion of the particles, so all the particles will leave the chamber relatively quickly. We will be given the initial conditions by a String init containing at each position an 'L' for a leftward moving particle, an 'R' for a rightward moving particle, or a '.' for an empty location. init shows all the positions in the chamber. Initially, no location in the chamber contains two particles passing through each other. We would like an animation of the process. At each unit of time, we want a string showing occupied locations with an 'X' and unoccupied locations with a '.'. Create a class Animation that contains a method animate that is given an int speed and a String init giving the initial conditions. The speed is the number of positions each particle moves in one time unit. The method will return a String[] in which each successive element shows the occupied locations at the next time unit. The first element of the return should show the occupied locations at the initial instant (at time = 0) in the 'X','.' format. The last element in the return should show the empty chamber at the first time that it becomes empty. Definition Class: Animation Method: animate Parameters: int, String Returns: String[] Method signature: String[] animate(int speed, String init) (be sure your method is public) Constraints - speed will be between 1 and 10 inclusive - init will contain between 1 and 50 characters inclusive - each character in init will be '.' or 'L' or 'R' Examples 0) 2 "..R...." Returns: { "..X....", "....X..", "......X", "......." } The single particle starts at the 3rd position, moves to the 5th, then 7th, and then out of the chamber. 1) 3 "RR..LRL" Returns: { "XX..XXX", ".X.XX..", "X.....X", "......." } At time 1, there are actually 4 particles in the chamber, but two are passing through each other at the 4th position 2) 2 "LRLR.LRLR" Returns: { "XXXX.XXXX", "X..X.X..X", ".X.X.X.X.", ".X.....X.", "........." } At time 0 there are 8 particles. At time 1, there are still 6 particles, but only 4 positions are occupied since particles are passing through each other. 3) 10 "RLRLRLRLRL" Returns: { "XXXXXXXXXX", ".........." } These particles are moving so fast that they all exit the chamber by time 1. 4) 1 "..." Returns: { "..." } 5) 1 "LRRL.LR.LRR.R.LRRL." Returns: { "XXXX.XX.XXX.X.XXXX.", "..XXX..X..XX.X..XX.", ".X.XX.X.X..XX.XX.XX", "X.X.XX...X.XXXXX..X", ".X..XXX...X..XX.X..", "X..X..XX.X.XX.XX.X.", "..X....XX..XX..XX.X", ".X.....XXXX..X..XX.", "X.....X..XX...X..XX", ".....X..X.XX...X..X", "....X..X...XX...X..", "...X..X.....XX...X.", "..X..X.......XX...X", ".X..X.........XX...", "X..X...........XX..", "..X.............XX.", ".X...............XX", "X.................X", "..................." }
  2. Hey guys, I modified a script that i found on the web and and i'm trying to use it as a thumbnail gallery scroller (for lack of better words). The problem i'm running into right now is that when i click either the left or the right buttons all of the boxes scroll. I'm trying to use the (this) "selector" but i'm having trouble figuring it out can someone perhaps help me a bit with this one? would be greatly appreciated. Here's the html. <div class="container"> <div class="arrowL"><img src="left.png" width:'20'; height:'100'; /> </div> <div class="arrowR"><img src="right.png" width:'20'; height:'100';/> </div> <div class="list-container"> <div class='list'> <div class="item"> </div> <div class="item"> </div> <div class="item"> </div> <div class="item"> </div> <div class="item"> </div> <div class="item"> </div> </div> </div> </div> The css. .item{ background-color:#FFFFFF; width:120px; height:90px; margin:5px; float:left; position:relative; } .container{ width:1000px; height:100px; } .list-container { display:inline-block; overflow:hidden; width: 960px; float:left; } .list{ background:grey; min-width:1500px; float:left; } .arrowR{ width:20px; height:100px; float:right; cursor:pointer; opacity:0.5; } .arrowL{ width:20px; height:100px; float:left; cursor:pointer; opacity:0.5; } And the js. <script> $(document).ready(function() { var $item = $('div.item'), visible = 7, index = 0, endIndex = ( $item.length / visible ) - 1; $('div.arrowR').click(function(){ if(index < endIndex ){ index++; $item.animate({'left':'-=300px'}); } }); $('div.arrowL').click(function(){ if(index > 0){ index--; $item.animate({'left':'+=300px'}); } }); }); </script> Anyone know what i'm doing wrong?
  3. $('.cart_item').hover(function(){ $('.remove_cart_item').fadeToggle(); }); So the issue is that when I hover over the div class cart_item, all the divs with class cart_item show the hidden div class remove_cart_item. How do I get it to just show for the div its hovering over?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.