Scroll-based animations: how to create them - javascript

I've come across this webpage: http://www.wsj.com/ad/cocainenomics
It shows exactly the kind of animations I would like to learn to create.
Nothing massively complex, just elements or layers coming in while the user scrolls the page (don't consider the 'powder' animation on hero visual).
What technique / programming language / js-based library would you expert animators advice as the best option to achieve this?
I'm considering:
pure jQuery animations
jQuery triggered css3 animations
a velocity.js-based approach with minimal jQuery use only for chaining an animation call onto a jQuery element object
What approach between these you guys deem to be preferable? Or do you have something else in mind?
Do you think that the mighty power of velocity.js is disproportionate for animations this simple? I've seen velocity demos and they are way more complex than the scroll-based animations the above website includes.

I've found success with Skrollr before for this sort of thing:
Check out the demo at https://prinzhorn.github.io/skrollr/
Look at the code at https://github.com/Prinzhorn/skrollr
EDIT: I've just looked at the Skrollr docs and noticed it stopped being maintained about a year ago. A quick Google brought up ScrollMagic as a possible alternative. I'd also recommend digging into the source code of the example site you provided, and seeing if you can get an insight into what they've used!
Velocity.js isn't necessarily something you'd go to specifically for the kind of scroll-position-based animations you're looking for - it's just an alternative option for doing the same as you'd do with jQuery's animate() but with behind-the-scenes magic to make the animations more efficient.
Strictly speaking, StackOverflow probably isn't the best place for this type of question (see the guidelines for questions over at https://stackoverflow.com/help/dont-ask) - so your question might get flagged by moderators!

please check this, https://codyhouse.co/gem/vertical-timeline/ i believe its exactly what you are looking for, check the demo here : https://codyhouse.co/demo/vertical-timeline/index.html
i believe its a pretty simple option, since its free and its fully customizable.
(also its almost only css with a little jquery)

Related

How to get content to slide in on scroll?

I just wondered how to get content blocks to slide in horizontally on scroll? It seems quite common on a lot of modern themes and I'm hoping to add this kind of effect on the homepage of http://brokernotes.co where we have the three 'how to' sections.
Any pointers on how to do this would be much appreciated.
There are lots of way to achieve this.
I would highly recommend using JavaScript over anything else to tackle this challenge, and on top of that I would suggest using jQuery where you can find some methods like $.hide() and $.show() which also allow you some nice animated transitions.
I also think that the example you provided relies on jQuery as well (they have jquery.min.js included as a script, etc.) so this is definitly the point where you want to start.
w3schools provides a tutorial series about jQuery where you can get started:
http://www.w3schools.com/jquery/jquery_examples.asp

flash website redone in jquery? feasible?

I'm considering attempting a redesign of a flash website with jquery effects and transitions in place. I just wanted to reach out to the community to maybe see how feasible this really is considering the particular transitions and effects this website has.
Here's the link:
http://antonynicoli.com/english.html
The gallery I guess can be recreated by carousel plugin, but there are so many out there so maybe could suggest a stable one that would be be best suited to this job. The other items that really caught my attention in which I wouldn't really know where to start is the navbar and the effect that looks like a book opening when you click on a link on the navbar. Any and all input would be appreciated. Thanks.
This is probably doable, but I'm wondering about the motivations behind changing to an HTML/jQuery solution when it looks pretty good right now (as Brad pointed out above, it would require a total rework). I see a couple of things going on:
Carousel: jCarousel (http://sorgalla.com/jcarousel/) (never used it but it is popular)
Animations: jQuery Animate (http://api.jquery.com/animate/)
Other widgets/interactions: jQueryUI: (http://www.jqueryui.com)
Not sure how you would go about the open-book animation, but I suspect you could accomplish it with some clever jQuery animations.
The best way to see if it could be done is: start doing it! jQuery has tons of resources and you'll get good help here on StackOverflow.
After looking at the site i do believe most of the effects can be recreated fairly well using jQuery. Of course, your end-result might not be as smooth as the flash implementation but i think it can be done.
If you look at using HTML 5 i believe a lot of animations such as page transition with the opening book can be simulated with the canvas element. Same with the navigation elements.
https://developer.mozilla.org/en/canvas_tutorial
http://diveintohtml5.ep.io/canvas.html#divingin
As you mentioned some of the effects such as the carousel can be recycled from existing plugins. The only holdback really is how much time do you want to invest in porting a design to a language not as well suited to do the job. jQuery is an excellent framework but it is far from a drop-in replacement to create effects that are trivial to create in Flash/Actionscript.
the whole site can be done with jquery. all you have to do is map out all the animation done on the site and write it on paper. then look for the jquery alternatives online and check them off one by one. some things might not be exact but it will do the job.

Fixing CSS positioning and scaling

I was contemplating writing a UI toolkit where setting the position and size of an element/widget was intuitive and powerful. Here are some examples of how it would be used (not currently implemented):
ui("Panel").size(". 40").pos("0 0").attach(element);
ui("Textarea").size(". %-10").pos("0 40").attach(element);
ui("Panel").size(". 10").pos("0 bottom+5");
Where . means auto, % means 100% and the possibility to add pixels to percentages.
Does anything like said exist (even as a jQuery plugin or something)? Somethings just aren't possible with pure CSS.
If you want to create it in Javascript you will have to make the script read the ui code then convert to css. This would cause too much overhead and wouldn't really be worth the hassle. It would be nice to have a quicker more intuitive way to create styles but unfortunately without paying in efficiency it wont work too well.
I would be very wary before lunching into this. This would give any devloper joining your project a major headache of needing to learn your new layout mechanisims.
I have yet to see what CSS can not do, so you may want to look into what it can do further before going ahead look at the various examples from http://www.csszengarden.com/ . I'm not saying CSS is easy but it is standard.
If you need more power look at CSS3 the majority of which can be achived using jQuery.
Sorry to say but I think you are heading down the wrong road by building your own. Use standard, tested, well knowen and documented way. Don't reinvent the wheel unless you are in the wheel making business.

Using jQuery for Effects

Ok - have been tasked with possibly an impossible (or at least a potentially nightmarish) scenario.
Need to come as close as possible to reproducing PowerPoint-like effects via HTML/JavaScript (the spec is large and ugly, so I will spare you the details).
Ultimately, I am looking for a solid launching point. I have used both Prototype/Scriptaculous as well as jQuery in many projects, and based on what I am seeing, it appears jQuery has the more plug-in available, so am leaning towards using jQuery.
Can anyone point me to some plug-ins, articles, or anything else that would help me in accelerating the research on this so I can define to my client what can and cannot be done.
Any other suggestions from you jQuery gurus are welcome of course.
Thanks -
What do you mean with "PowerPoint-like" effects. If you mean animations between slides you should look into
the Effects available with the standard jQuery download (fadeIn, fadeOut, slideDown, slideUp, ...)
the jQuery Easing plugin
the jQuery Cycle plugins effects browser
I would certainly look at jQuery UI as well, which adds a number of effects. See here for a current list. Click on the link for each to see several demos, there are quite a few options for some that are powerpoint-ish.
For example, try the various options in the dropdown here.
The jQuery documentation is very good:
jQuery animate docs
However, if you are trying to achieve very complex effects you will almost certainly benefit from using a different framework. jQuery is a fantastic tool - particularly with the DOM, but animation isn't its strongpoint.
MooTools has a particularly good animation library (MooTools began life as a JavaScript animation framework) with a number of core modules that give you flexible tools to create complex animation chains yourself as well as a number of official and community-provided plugins. My recommendation would be to at least have a look at that first. You can certainly achieve this in jQuery but you will be making it more difficult for yourself!
MooTools homepage
Mootools Core Documentation
My $0.02: If you're doing complex effects, you need the library that runs the fastest, not the library that is the easiest to work with.

Best way to achieve blockUI functionality WITHOUT using jQuery or any other library?

As much as I love jQuery, it is not always possible to use open source libraries (for reasons having nothing to do with technology). How best to achieve BlockUI functionality using raw javascript? I am really only interested in making it obvious to the user that the browser is busy, and preventing the user from making any more selections. My jQuery-less situations happen to involve only IE 6, so IE 6 is all I'm interested in at this time. I'm trying to avoid a "copy/paste the relevant parts of BlockUI" type of solution.
The general idea is to create a div that covers the entire viewport and has a high z-index, with some level of opacity set. A quick look at the BlockUI source should help you to write your own.

Categories