Simple animation - Flash or jQuery? - php

I have some animation I would like to try, kind of a shopping cart/checkout action animation. wanted to know if flash or jQuery (JavaScript) would be best?
The backend is all in PHP and I was thinking of using AMFPHP (If Flash) or jQuery (Any frameworks???) but wanted to know the drawbacks/features of each approach.
Thanks for any advice,
--Phill
--UPDATE--
Okay so the animation I would like is when something is purchased to display some text and a image of the item in some sort of slick animation. Want to give it that Flash feel but maybe I could do this in jQuery?
-- UPDATE--
Would like it to have a TV commercial feel but interactive, not sure of the animation(s). Clean, Crisp, Fresh, etc...

JQuery is better because it's easy to program a compelling experience with just notepad. My rule of thumb is "If you don't need flash, then don't use flash." Also a lot of people are using iPhones to surf the internet now, you don't want to alienate that market by plopping a big flash hurdle in front of them that they can't jump.
Check out Themeforest.net and see what designers are doing with just JQuery. It's pretty amazing how far we've come with just simple javascript.

A lot of animation that we typically turned to Flash for can be accomplished via jQuery. Obviously, frame based (onion skinning) type animation (characters, cartoons, etc.) is still best left to flash, but nearly any type of animation you'd do in flash with tweens (position, size, color, opacity, width, height, etc.) can easily be accomplished with most of the modern .js libraries including jQuery.
So, yes, jQuery would certainly work depending on the particular type of animation you are looking for.
UPDATE (per your updated info):
"TV commercial feel but interactive"
What does that mean? If I were to interpret that literally, what you want to do is produce actual video based content and wire it up in Flash.
However, that seems like a heavy overhead to just check out of a shopping cart. I'd really think about this from a UX perspective before going too far down this path.
"Clean, Crisp, Fresh"
So not dirty and blury? ;)

Related

Making a "mosaic" effect in php & javascript

I'm trying to create a mosaic type script in Javascript and PHP, which makes up a big image with many different images made from small square tiles. The idea was to "fake" the effect by having a background image and laying over the tiles on top of it, and making their opacity 50% or so. This works decently enough, but it definitely doesn't look as good as I want.
My question is, does anyone have any recommendations on alternatives to this method? I know there are definitely ways to do this in Flash, such as the Mario Lemieux mosaic:
http://www.mariomosaic.com/mosaic/
But I would like to avoid flash if possible.
edit: added live example
So I haven't touched the JS layer yet, this has all been server-side stuff. There's no pre-loader or anything really in terms of making it more usable, that will come soon. But here's what I've got so far:
http://www.mtimofiiv.net/mosaic_example/
The little tiny image tiles are created from images uploaded by a user, and they're run through a class I've built to generate them. I used GD2 to make them grayscale so they will absorb the color of the background image better, and I "pixelated" the background image in Photoshop.
If anyone wants to see any part of the code let me know and I'll add it to this post. Also when this project's done I intend to make it available on Github in its entirety for whoever wants to do the same.
Perhaps the fact that your demo HTML is 733KB might dissuade you from this particular approach. I think if you want to do something like this, you really ought to employ the canvas element, and work in some kind of "ajax" loading. That could actually be kind of interesting. However, if you are going to generate this much HTML...you might consider having a client-side script do it, if possible. Just some thoughts...

photo album for website

I want to have a photo album on my website such as this:
http://www.yelp.com/biz_photos/B9S9wNChMFRz6IAL_0n6pA?select=ADeqFE2Tj2s7eM8WuQibbQ
I'm looking for something where the photo that is displayed is also highlighted as thumbnail below that so that users can select photos rather than having to click next.
Also, I want to be able to have multiple photo albums so each set of thumbnails is different. Perhaps something where the whole page doesn't have to reload, but just the photo itself and the highlighted thumbnail?
I've done some research but I'm unsure of which type is best ie- PHP, javascript, etc...
I only have experience in HTML, CSS, and basic javascript and limited PHP.
I'm hoping somebody can point me in the write direction as to what to look for.
Thanks
Learn jQuery.
http://www.jquery.com
Rejoice!
http://blueprintds.com/2009/01/20/top-14-jquery-photo-slideshow-gallery-plugins/ <-- take your pick.
The jquery cycle plugin is fantastic and super easy to set up:
http://jquery.malsup.com/cycle/
and specifically it has the ability to do auto-thumbnailing as navigation:
http://jquery.malsup.com/cycle/pager2.html
If you know CSS you can take it from there.
As I myself am not the best (but still trying to get better!) when it comes to the more UI related technologies (CSS, JS, HTML etc), I have found using popular libraries such as JQuery Tools to be quite helpful and very easy to use. I believe the widget below matches up with what you are looking to do, and it also comes with a tutorial and helpful customization examples:
http://flowplayer.org/tools/demos/scrollable/gallery.html
Best of all I think JQuery Tools and Flowplayer are open source, so that means once you get the widget working, you can also delve into the code to try to gain a better understanding and hopefully one day take your own crack at a similar solution.
Good luck!

Ajax with slide effects onready witout using a toolkit

I'm really not that good at Javascript and that, so I need another bit of help. I want to be able to do a quick bit of AJAX using PHP then when the ajax response is finished show the response in a div and SLIDE it down nicely.
The basic AJAX side of it is no problem. But I want to be able to have it slide nicely without using any framework like jQuery or MooTools. Mainly for learning, but there are other reasons. So, any help on a very simple way od doing so would be handy. I can't really find much online. If I have to use jQuery then I guess I can, I have played about with it but I'm not a fan of Javascript at the best of times...
So yeah, pretty much any advice/tips/thoughts/help would be really handy!
I guess the basics would be something of a timeOut() in combination with increasing the height until it is full height:
set the display of the element to none
get the full height of the element, something like:document.getelementById('IDofElement').style.height
set the height to 0 and the display to something like block
set a timeOut() and increase the height in the called function, activate a new timeOut() if the element is not already full height.
The only real disadvantage of not using a library would be that you would have to test in a lot of different browsers and perhaps make modifications according to the browser used. Libraries have already solved that problem for you.
Personally, I'd just use JQuery. If you want to see how they do it, then download the developer version of the library and look at the code.
If you're not a fan of javascript, then use a library, it means you have to write less.

gif loader centered as top layer

I have a php form. After this form is submitted, if all data is valid, then it executes a python script which takes 5-10 seconds. For this wait period I would like to have a progress bar (.gif) displaying in the middle of the screen. If I could also 'fade away' the background so that the progress bar was like a top layer and the background a back layer, that would be great.
Thanks.
Are you using any javascript libraries, such as jQuery? In any of the libraries, I'd imagine there'd be a dozen or so lightbox plugins floating about. Even if you don't want to use a library, you can take a look at their code, and instead of displaying a DIV, just display your gif, if you know what I mean.
There are even some plugins built specifically for this purpose, such as the BlockUI plugin for jQuery.
The basic algorithm for doing what you want goes like this:
Start Ajax Request
Display semi-transparent dark image over the whole page, with an animated gif in the middle.
Listen for Ajax response
Remove the overlay and loader gif.
I assume you already have steps 1 and 3 going alright. Step 4 is easy-peasy. Step 2 however isn't as easy, but still shouldn't be too hard. I couldn't tell you the code to do it myself, since I've just used lightbox plugins in the past. Take a look on Google for "simple lightbox" or something like that, since all you really want is the most basic functionality. This blog post talks about a CSS-only lightbox which would be a good starting point to help you style the overlay.

sIFR or FLIR?

I've recently bumped into facelift, an alternative to sIFR and I was wondering if those who have experience with both sIFR and FLIR could shed some light on their experience with FLIR.
For those of you who've not yet read about how FLIR does it, FLIR works by taking the text from targeted elements using JavaScript to then make calls to a PHP app that uses PHP's GD to render and return transparent PNG images that get placed as background for the said element, where the overflow is then set to hidden and padding is applied equal to the elements dimensions to effectively push the text out of view.
This is what I've figured so far:
The good
No flash (+for mobiles)
FLIR won't break the layout
Images range from some 1KB (say one h3 sentence) to 8KB (very very large headline)
Good documentation
Easy to implement
Customizable selectors
Support for jQuery/prototype/scriptaculous/mooTools
FLIR has implemented cache
Browsers cache the images themselves!
The bad
Text can't be selected
Requests are processed from all sources (you need to restrict FLIR yourself to process requests from your domain only)
My main concerns are about how well does it scale, that is, how expensive is it to work with the GD library on a shared host, does anyone have experience with it?; second, what love do search engines garner for sIFR or FLIR implementations knowing that a) text isn't explicitly hidden b) renders only on a JavaScript engine.
Over the long term, sIFR should cache better because rendering is done on the client side, from one single Flash movie. Flash text acts more like browser text than an image, and it's easy to style the text within Flash (different colors, font weights, links, etc). You may also prefer the quality of text rendered in Flash, versus that rendered by the server side image library. Another advantage is that you don't need any server side code.
Google has stated that sIFR is OK, since it's replacing HTML text by the same text, but rendered differently. I'd say the same holds true for FLIR.
I know that with sIFR, and I assume with FLIR that you perform your markup in the same way as usual, but with an extra class tag or similar, so it can find the text to replace. Search engines will still read the markup as regular text so that shouldn't be an issue.
Performance-wise: if you're just using this for headings (and they're not headings which will change each page load), then the caching of the images in browsers, and also presumably on the server's disk should remove any worries about performance. Just make sure you set up your HTTP headers correctly!
since FLIR is IMAGES and sIFR is flash i would imagine that it would be a bit more resource intensive to use sIFR. I havent run any tests but it seems logical.
Search engines search sIFR better than FLIR because some search engines can go into the text of a flash document
I don't know much about sIFR because FLIR worked, and it "felt" better to me than Flash. Just looking at the sIFR 3 beta demo page I noticed that it doesn't seem to react to browser preference text resizing. That is, I increase my font-size in Firefox (ctrl-+) and reload the page, the headings stay the same size.
To those who know sIFR, is this an actual limitation of the script or did they just do the demo page wrong?
If it actually doesn't handle this, I'd call that a major advantage for FLIR, which does work this way. People with impaired vision who don't use screen readers probably don't appreciate that the text doesn't resize to their preference.
That said, from a quick glance at sIFR's API, you should be able to make resized text work in sIFR. I'd consider it a bug to be fixed, not an essential disadvantage of the method.
Woff files is the best solution.
http://www.fontsquirrel.com/tools/webfont-generator

Categories