Showing posts with label HTML5. Show all posts
Showing posts with label HTML5. Show all posts

Tuesday, December 13, 2011

Adobe Edge animation controlled by the scrollbar! its easy and fun.

How to make your animation controlled by the scrollbar in Adobe Edge Preview 3:

Adobe edge is a great HTML 5 editing tool, and with a few tweaks I think it will end up being the best html5/javascript/jquery tool on the market for professionals looking to create highly interactive non-flash interactive animations. I've been a flash programmer for 14 years now, and I actually enjoy working on the timeline so Adobe Edge is a lot more creatively satisfying than working with eclipse to make "interactive art", at least for me.

In this example I made an animation in Adobe Edge that the user "Scrubs through" with the scrollbar instead of it just playing automatically as is the default for Adobe Edge. I think its a good way to introduce the lay person to the concept of scrubbing a playhead through time, and would make a neat "popup book" for kids with a simple approach like this as it is a different use of a familiar UI element, the scrollbar. As a flash user, I've always hated scrollbars because I think information should be presented in one place using time/animation rather than making the user scroll through it, but I have built them from scratch in flash AS3 (see previous post) and this makes for an interesting continued experiment with the things.

Example (drag the scrollbar to advance the animation)
http://www.northeastmagic.com/adobeEdge/scrollbar_scrubber/test7.html

Allowing the user to scrub through your html5 animation created in Adobe Edge allows them to have a "popup book" feel of control over your work, making it interesting to play with. Scrolling is a familiar control interface but using it as a playhead scrubber opens up a new realm of possibility to the user unfamiliar with animation development. Note: the animation has to be wider than the users's viewport or this wont work - so you designers with huge monitors will have to shrink the window down a bit...

From an animator perspective, try to make your animation in segments that can be easily divided into the physical width of the artwork (or height if you are vertically scrolling). So for example a 4 second animation could be 2000px wide, and you basically do 1 scene inside 500px, bearing in mind that animation occurring in the left side will not be visible as the user scrolls through the piece. (Per second you allow 500px for that "second's" scene. Its a weird way to think about animation but hopefully thinking of it this way will help.

As of writing this article, Adobe Edge preview 3 is fairly buggy, for example trying to work with objects that go beyond the right side of the viewable area is problematic since the selection tools basically become unavailable when you scroll. My workaround for that was to do the animation in the viewable area first, then move the playback head to 0:00, then translate the x of the animated objects to the far right as far as I could without losing selection. Interestingly when you translate an object while the playhead is at 0, it affects all keyframes of the object, so this seemed to be a workaround for now. Hopefully adobe will address this, as well as adding the ability to set the width/height with percentages instead of px, and individually control the overflow handling of the vertical and horizontal scrollbars.

1. add a trigger to the beginning of the animaton this.stop();




2. add a "scroll" event to the stage top right. paste the following code in there

// insert code for scroll event here
var myCalc=this.element.scrollLeft/(this.element.scrollWidth-this.element.clientWidth);
this.stop(myCalc*this.getDuration());




3. make the animation etc. work at the full width. Make a note of the stage width you picked (2000px etc.) top left.




4. when finished save, leave edge and look in the files it created.

5. Open the one called "MYFILENAME_edge.js" in dreamweaver

6. do a find for "2000px" or whatever the width was that you picked. .... replace width value with "100%"

something like : id: "eid1", tween: [ "style", "${_stage}", "width", '100%',

is the important one. There should only be 1 _stage line. If there is more you've tweened the stage and you should remove them.

7. if you are scrolling horizontally you'll need to hide the vertical scroller like this:


one of the objects should have a stage object, add the overflow-x and overflow-y appropriately:

"${_stage}": [
["color", "background-color", 'rgba(12,12,13,1.00)'],
["style", "width", '500px'],
["style", "height", '400px'],
["style", "overflow-y", 'hidden'],
["style", "overflow-x", 'auto']
],

REALLY IMPORTANT, dont forget to make sure there are commas between each line and NOT one on the end of the last line

if you want to vertical scroll, use overflow-y auto and overflow-x hidden, and set the height to 100%. You can also set both height and width to 100% to push the scrollbar to the bottom of the frame.

I still think flash is far more advanced of a tool for animation and rich internet applications, but given the landscape of politics these days with iOS refusing to allow flash for their own inane reasons, we can learn to "build a ferrari with toothpicks" and use HTML 5 / javascript to appease the ignorant "flash haters" out there.

About the author:
Ryan Cameron is CTO of SweetRush inc., a SanFrancisco based e-learning and interactive technology development company. Ryan works virtually and lives in Nova Scotia, Canada.

Saturday, May 1, 2010

The future as I see it...HTML 5? Flash? whatza whooza?

I see Flash/Actionscript it as I've always seen it, a specialized UI tool for building rich internet applications, and there isnt anything else on the market that accomplishes this task as well as flash at the moment - and in the forseeable future. Should something come along that does it better, I have no particular loyalty to Adobe and would be the first to embrace the new technology, in fact, for the latest stuff I have been building flash files in non-adobe products for the most part, only using the free flash compiler that comes with the flex sdk to do my compiles - but I could be using something else if I felt it was worth the effort.

I think if Adobe is smart, they have an opportunity to blur the lines between HTML 5, flash, and anything else by simply making an authoring tool that compiles to any format, and even player technology or scripts that interpret flash to HTML 5 and back on the fly. This would effectively end the debate of HTML5/flash, and render "player technology" irrelevant, which it pretty well already is since flash is embedded so deeply in most browsers outside of the iFamily. End users dont care if their games are HTML5, flash, javascript or whatever, the only people who care are developers, so the drama continues. Adobe clearly realizes it is not in the "plug in" business, it is in the authoring tool business, so their authoring tools should continue to output in every possible format for every possible platform, the only limitation being the platforms and formats themselves. Adobe is in a better position than most companies, it knows how to write RIA authoring tools better than anyone, hell, it invented the concept. Adobe is capable of being so flexible, no other large corporation can really hurt it. For example, Apple said no flash on iPad. So, adobe makes a compiler within a few days that authors app store compliant software for the iPad. Apple gets angry, and responds by blocking any content that is authored by flash cs5. This is ridiculous, because you can bet almost every visual on the apple platform was partially designed using an adobe product, including the hardware. Apple has succeeded in making itself look like an immature baby, and Adobe simply says "fine, we did everything reasonable, and if you want to act retarded, we simply will focus our energy on another platform...android". Apple thinks they've beaten adobe...ha ha. Adobe's dreamweaver is CURRENTLY the best authoring tool for HTML 5, which Apple believes is competition to Adobe. Again, ha ha. Adobe outputs in SVG (HTML5's parent technology) - which Adobe essentially invented, and compiling html 5 from the flash authoring system is actually very logical, and flash CS5 will likely be the #1 choice for making html 5 canvas based content. Apple makes more money than Adobe, but they dont get content authoring like Adobe does. Neither does Microsoft for that matter.

What I am suggesting means that if a user who does not have a flash capable browser visits a flash site, the site could, on the fly, prepare an HTML 5 version for them automatically. This is not difficult, or particularly processor intensive, as it would only need to be done once for the particular platform. A "flash to html5" converter could reinterpret almost any flash site into HTML 5 automatically, so the legacy content would all continue to work without a hitch, and new content could be published directly to HTML 5. That is why HTML 5 is not the future. The future is..."who cares technology", IE the path of least resistance, lowest cost.

If I am an animator and it will take me 25 weeks to produce a cartoon in HTML 5 vs 2 hours in flash, there is no contest. If I can output in both formats with a 1 button publish, then there is no debate, not even a conversation about it. My animation will work on old browsers, new ones, iPads, apeDods and dewDads. THAT is the future, I believe. Whatever is cheapest, easiest, and gets the nerd junk out of the way so creatives can express without having to ftp the htp and mno the qrs. Html whatsit? Flash-a-who-eee?

There will always be a need for niche, customized software in spite of all the attempts by the drupals and nings of the world to provide an easy button because if something is too easy, it becomes nearly impossible to differentiate yourself from everyone offering the same product for free. So in this respect, the best language for the job will be the tool of choice, and right now the clear winner is OOP ECMA. All modern languages are ECMA compliant, and the others are dropping off because they are hard to use and clumsy in comparison, like Objective C, C, C++, Perl, PHP, etc. are the "olden days" and ECMA represents the modern languages like C#, Javascript and its growing libraries, Actionscript 3 etc, all of which can now be authored in eclipse. Again, path of least resistance for developers. I can write in ECMA languages for pretty well every platform, and they are all standard compliant, so the only difference is the compiler/player, which, quite frankly, I dont give a damn about. For me to publish our LMS in HTML 5 in two years, I likely wont have to rewrite any code, there will simply be another checkbox for "output to html5" and voila, done. Company saves millions, and I can concentrate on adding features instead of trying to comply with a non standardized language to rewrite everything...which is incredibly inefficient. ECMA is the "english" of the programming language world, and its already won. Javascript, jQuery, C#, and Actionscript 3 are all together on that front.

They used to say "content is king". I imagine that is still the case, and the amount of flash content out there that is in flash is massive, several orders of magnitude more than what is contained in the "app store". At the same time, only some of that content is video based and can be easily converted to HTML 5 for the iPad/iPhone. Its much easier to write a translation tool than to redo all that content, so that is most likely what is going to happen. Check out www.homestarrunner.com on your iPad for example. Those guys will NEVER spend the time and energy to convert 3 years worth of weekly flash episodes to HTML 5 manually, but a converter would take care of it instantly. The ONLY thing stopping a converter from being made is HTML 5 itself. The format simply isnt ready to handle the complexity required by that content to render properly, but you can bet the second it is ready, some free converter will be available and it will all run smoothly everywhere. For Steve Jobs and the iFamily's sake, that will hopefully happen sooner than later, otherwise many consumers will drop their iFamily product in favor of Android or whoever offers a full flash player because they can get all the app store games for free, as well as all the legacy flash content out there that will likely never be converted to HTML 5 manually. "If I can get "boob shake" app that Apple refuses to allow in its app store on Android for free without having to use iTunes or sign any kind of confining DCMA and basically remain anonymous...well, my iPod touch is going in the bin of old adapters and pocket pcs." says joe daily show fan.

Sorry about the long post, of course, but the issues here are complex and intertwined.