Creating Advanced “Marquee” with CSS3 Animation |
- Creating Advanced “Marquee” with CSS3 Animation
- Freelancers: How to Deal With Insecurities
- How to Synchronize Video and Subtitles
Creating Advanced “Marquee” with CSS3 Animation Posted: 27 Jun 2012 04:08 AM PDT Today we are going to take a look at “marquee” once again. We actually have covered about it in our previous post which talked about using the In this post, we are going to create a marquee-like effect using the CSS3 Animation. That way we will be able to add more functionalities that could not be attained with only the Unless you are already familiar with the CSS3 Animation module, we recommend you take a look at the following references before proceeding with this documentation:
Also take a note that, at the moment, CSS3 Animation can only work in Firefox 8+, Chrome 12+ and Safari 5.0+ with the prefixed version ( Addressing Marquee IssueOne of the problems with marquee is that the text is continuously moving. This behavior is disruptive to reading, and the text is also difficult to read. This time, we will try to create our own version of marquee and make it user-friendlier. For example; instead of having the text move continuously, we will stop it when it is fully visible, so the user can read the text for a moment. The Storyboard (sort of)Every creative and design creation, like a logo, an illustration or a website, usually starts with a sketch. In the field of animation production, this is done with a storyboard. Before we start on any coding, we will first create a sort of storyboard, to help us visualize our animation. As you can see from the above storyboard, we plan to show only two lines of text, which will both move sequentially from the right to the left. Our storyboard is not as complicated as a storyboard for real animation movie, but the point is: we are now able to visualize how our marquee will look like. The HTML MarkupSince our animation is going to be simple, the HTML markup will also be as simple as: <div class="marquee"> <p>How to add WordPress Related Posts Without Plugins</p> <p>Automate Your Dropbox Files With Actions</p> </div> The Basic StylesBefore working around the animation stuff, let’s add some basic styles. Let’s start off by adding a background texture for the html { background: url('../images/skewed_print.png'); } Next, we will place the marquee at the center of the browser window as well as add some details like inner shadow, background color and borders. .marquee { width: 500px; height: 50px; margin: 25px auto; overflow: hidden; position: relative; border: 1px solid #000; margin: 25px auto; background-color: #222; -webkit-border-radius: 5px; border-radius: 5px; -webkit-box-shadow: inset 0px 2px 2px rgba(0, 0, 0, .5), 0px 1px 0px rgba(250, 250, 250, .2); box-shadow: inset 0px 2px 2px rgba(0, 0, 0, .5), 0px 1px 0px rgba(250, 250, 250, .2); } Then, we will position the text – which in this case is wrapped inside a paragraph tag – absolutely, and since the .marquee p { position: absolute; font-family: Tahoma, Arial, sans-serif; width: 100%; height: 100%; margin: 0; line-height: 50px; text-align: center; color: #fff; text-shadow: 1px 1px 0px #000000; filter: dropshadow(color=#000000, offx=1, offy=1); } Let’s take a look at the result for a while. At this point, we have done with all the basic styles we need; you are free to add more or personalized the styles. But, we suggest you stick with our specified marquee dimension (the height and the width) until the end of the tutorial. The AnimationIn short, animation is a presentation of moving objects. Each movement is defined in a time frame. So, when we are working on animation, we are mostly dealing with the Time. We take into account matters like:
In CSS3 Animation, the time can be defined with the We have planned that the text will start from the right then move to the right. So, here we will first position it to the right using the CSS3 Transformation property. .marquee p { transform:translateX(100%); } Remember, the 100% that we have defined for our paragraph element was equal to its parent KeyframesThe Click here to see the larger version. The whole animation will last about 20 seconds and is divided into two sequences lasting 10 seconds each. In the first sequence, the first text will instantly slide-in from the right and remain visible momentarily to let the user read the text, while the second text will remain hidden. In the second sequence, the first marquee text will slide-out to the left, and the second text will immediately slide-in from the right. And here are all the keyframe codes we need to apply to run the animation. @keyframes left-one { 0% { transform:translateX(100%); } 10% { transform:translateX(0); } 40% { transform:translateX(0); } 50% { transform:translateX(-100%); } 100%{ transform:translateX(-100%); } } @keyframes left-two { 0% { transform:translateX(100%); } 50% { transform:translateX(100%); } 60% { transform:translateX(0); } 90% { transform:translateX(0); } 100%{ transform:translateX(-100%); } } The Applying Animation to the ElementsFor the animation to work, don’t forget to apply the animation to the element. The first sequence is applied for the first text or in this case first paragraph and the second sequence is applied for the second paragraph as well. .marquee p:nth-child(1) { animation: left-one 20s ease infinite; } .marquee p:nth-child(2) { animation: left-two 20s ease infinite; } We are all done with our animation; let’s see the results on the browser. BonusWe can also define the marquee text to move it from top to bottom or vice versa, just like we did in our previous post. Here is how to do it; replace our above Animation codes with this one below to move the text downwards: .marquee p { transform:translateY(-100%); } @keyframes down-one { 0% { transform:translateY(-100%); } 10% { transform:translateY(0); } 40% { transform:translateY(0); } 50% { transform:translateY(100%); } 100%{ transform:translateY(100%); } } @keyframes down-two { 0% { transform:translateY(-100%); } 50% { transform:translateY(-100%); } 60% { transform:translateY(0); } 90% { transform:translateY(0); } 100%{ transform:translateY(100%); } } Notice that we have changed the X-axis to Y-axis and flip all the We also have renamed the Animation to .marquee p:nth-child(1) { animation: down-one 20s ease infinite; } .marquee p:nth-child(2) { animation: down-two 20s ease infinite; } Or else, if you want to move it the opposite; from bottom to the top. Here are all the codes you need to apply: .marquee.up p { transform:translateY(100%); } .marquee.up p:nth-child(1) { animation: up-one 20s ease infinite; } .marquee.up p:nth-child(2) { animation: up-two 20s ease infinite; } @keyframes up-one { 0% { transform:translateY(100%); } 10% { transform:translateY(0); } 40% { transform:translateY(0); } 50% { transform:translateY(-100%); } 100%{ transform:translateY(-100%); } } @keyframes up-two { 0% { transform:translateY(100%); } 50% { transform:translateY(100%); } 60% { transform:translateY(0); } 90% { transform:translateY(0); } 100%{ transform:translateY(-100%); } } ConclusionDespite the lack of current browser support, CSS3 Animation, if done properly, will undoubtedly solve many usability issues in the future, like we have done in this example. If we need only a short animation intended for modern browsers, using CSS3 Animation is probably better than having to load a jQuery script. Lastly, we are aware that this article may be a bit overwhelming for some people, so if you have any questions regarding this article, feel free to post it in the comments section below. Related posts: |
Freelancers: How to Deal With Insecurities Posted: 27 Jun 2012 04:04 AM PDT The taste of success in the life of freelancers is much sweeter, if they can overcome the barrage of insecurities scattered on their path to success. Take a peep into the life of a freelancer, and all may look hunky-dory: freelancers seem to work on less than what a full-time employee would, they seem to sleep a lot, and most importantly, they get work based on their own convenience. Those who are not freelancers are particularly impressed by the laidback style that defines the working life of freelancers, which may in turn spur them to decide going down the same path.
What these ‘outsiders’ don’t see is the amount of hard work and insecurity every freelancer has to go through to realize their dreams. The truth is, despite consistent hard work, not every freelancer can turn up successful. One reason is that they are unable to deal with the pressure of having insecurities as a major part of their career. Those who depend solely on freelancing for their daily bread are the ones who are most insecure. In this article, we give you an inside look into the insecurities that trouble freelancers and what you have to prepare yourselves for to establish a career in freelancing in the long run. Recommended Reading: More Freelance-related posts. Ensuring a Steady Flow of WorkThe nature of a freelancing profession is such that nothing is guaranteed. As soon as he completes an assignment, he has to start looking for another one. New freelancers will feel this more than seasoned ones, but even the most successful, at times, struggle to get new jobs. This is the most striking insecurity that freelancers face these days. The tough competition for jobs has made the piece of the pie smaller for each freelancer. To ensure a steady flow of work and income, it is important for a freelancer to build a strong and large clientele to pull assignments from. It is equally as important for freelancers to complete each assignment well, and win over the client. A satisfied client will return with more job offers. Building good rapport with clients will pave more opportunities for freelancers, keeping the hunt for assignment minimal, so that more time can be spent on getting the job done well. Fear of losing clientsIn all my years as a freelancer, I feel that losing a client tops the list of a freelancer’s insecurities. It’s hard for me to pinpoint the reasons for a loss. I had faced situations in which I thought I had completed assignments perfectly, but still, I lost the client. Despite the amount of hard work you put in, clients can be very hard to deal with at times. I came to realize eventually that it’s not just about doing things perfectly, but also doing them in a manner which impresses your clients.
This is why freelancers should never get complacent with their work, even when working with long-term clients. Such an attitude could be detrimental to your career. It doesn’t matter how many good jobs you have done for them, it takes only one mistake to make a clients stop coming back to you. Each client is precious, so give your best in order to retain your clients. One good thing from this insecurity is that a little fear could turn into a recipe for success. Scouting for New assignmentsYou never know when you may go through a dry spell when it comes to getting assignments from your clients. At times, there seems to be no end to the wait for the next job. Such situations do arise, and the best thing a freelancer could do is to scout for new sources of job opportunities. But even this should be attempted within reason – don’t increase your clientele base too quickly, otherwise you might just crash from the overlapping deadlines and conflicting requirements. Fulfilling commitments from a long list of clients simultaneously can affect freelancers. You don’t want to deliver a bad first impression with new clients and you can’t afford to renegade on the deadlines set by your long-term clients. The decision on which job to rush first may be a real pain, so it’s best to not put yourself in the terrible position to have to choose. Quoting the Worth of your ServicesMany freelancers fall into a dilemma when asked to quote a price for their services. They fear losing a client if they quote a higher price. On the other side of the fence, clients might reject freelancers who quote below par for their services, believing that they may not be up to the mark for the required task. I myself had faced similar situations when I was not sure on how to break the ice. The best solution I follow is to quote a price I have been charging other clients. It is important to find jobs that pay according to your expectations. Finding jobs that pay less will always throw you into a fix. These clients will never increase the price, and instead may force you to decrease your price. Losing money from unsatisfied clientsThere are plenty of instances when freelancers fail to receive their payment, just because the client believes that the completed assignment is what was requested, or substandard. You may have worked hard all through the project, given 18 hours a day to it, but finally, all your efforts go unrecognized and poured down the drain. If your client has decided not to use your work, there is very little you can do anything about it. A freelancer will always be plagued with the fear that a client might refused to pay, if he doesn’t like the work. The only way left is to sell the work to someone else. If your client refuses to pay you the money for the completed assignment, you have the right to sell it to other clients, or use it somewhere else. A client may have his own reason for not accepting your work. Instead of worrying about the money lost, think of ways to salvage what you can by taking your work elsewhere. ConclusionInsecurities will always exist for freelancers. The best freelancers are those who learn to accept and overcome such insecurities and come out stronger than ever. In the freelancing line, you have to learn to live with these insecurities and learn to deal with them. Related posts: |
How to Synchronize Video and Subtitles Posted: 22 Jun 2012 04:44 AM PDT Watching movies with fast or delayed subtitles is like singing a karaoke song when the subtitles doesn’t sync with it’s music. It can be stressful especially when it’s a movie you like to watch, but which is not in your own language. Probably, the ability to just pause a movie and drag the subtitle to a suitable timeline position may put you at ease, but this is never the case. So having the option to edit the subtitle so that it will sync with your movie timeline may be a solution you want to look into. That’s right, there’s a way to re-sync your movie subtitle and we will show you how to do it with KMPlayer, a video player that supports many video formats with options to change, re-sync and even edit your movie subtitle. Recommended Reading: How To Make Time-Lapse Video – Ultimate Guide Sync subtitles with the videoIn this tutorial, we will be using KMPlayer to sync subtitles with its video, therefore if you don’t have one, head over to the download page and install KMPlayer on your computer.
ConclusionEverything is now set with KMPlayer. Now you need not stress out from watching movies with delayed subtitles, since you can now re-sync the subtitles on your own, on any specific line or for the whole movie. There are many more options available on KMPlayer which you can explore and find useful. Related posts: |
You are subscribed to email updates from hongkiat.com To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
0 comments:
Post a Comment