Monday, 29 July 2013

Spotlight on LearningEarly.co.uk

Learning Early started using WebBox services about 2 and a half years ago. They started with a simple e-commerce solution but over the years this has evolved to a bespoke solution with online marketing services. So here’s a little more about them…


We specialise in a revolutionary balance bike for children called the Strider bike. It’s designed for kids from as soon as they can walk up to 5 years – super light for toddlers and fully adjustable handlebars and seats means it works for children of all sizes . We sell them online and with a complete range of children’s helmets from world leading manufacturers such as Bell and Giro.


The playground – seeing another child on a wooden bike with no pedals seemed like a great idea and three years ago when we started, a “balance bike” was a new concept to the UK. Removing the pedals takes the complication out of learning to ride a bike and allows the child to concentrate on learning their balance.


With no budget! We bought a few bikes, sold them and bought more bikes. We then used the profits to buy our domains and used a free Getting British Business Online site to start. We kept investing our profits into things that improved the customer experience, a better website and a more efficient delivery service. Using our own children as demo riders also helped keep the marketing costs down.


Wasted valuable time at the start teaching myself how to build a website. In hindsight we should have just launched with a professionally designed site from the start, although the site I did build did get the cash flowing and taught me some great skills. Have faith in what you do was the lesson learnt there.


Entering our business in the Smarta awards – we were shortlisted as one of the Top 100 small businesses in 2011, by a panel of judges including, Sarah Beeney off the property show and backed by Deborah Meaden off Dragons den. Choosing to work alongside efficient partners day to day, that understand small businesses is also key. Choosing Web Box Cardiff from the minefield of web designers was a good move. Very handy to get hold of your Web design company at 7 pm on a Friday when I’ve managed to take my own site down..


To keep doing what we are doing and to ensure we do it better than any of our competitors.


So now you know where to go for your next Balance Bike!


View the original article here

When toolkits are better than frameworks

 Let’s start with an observation: I love me some frameworks. As an alternative to completely reinventing the wheel, or styling a button from scratch, again, it’s hard to beat having an all-in-one solution to your basic HTML/CSS/JavaScript needs.


The problem is, well, it’s what I said right up there. Frameworks really aren’t an all-in-one solution are they? For all that we’ve made them modular and easy to customize, sometimes they just don’t have what we need.


It’s impossible to include every possible HTML snippet, element style, or javascript function one could possibly need. But then, that can also be a good thing.


A framework might have a lot of things we just don’t need. Some of my most frustrating work ever involved manually searching through Bootstrap’s massive CSS files to change some small bit of code that was wreaking havoc on my design.


Just take Bootstrap’s navigation bar component for example. It’s great, it works flawlessly, and it looks good. But if you try to change the way it looks in any big way, you have to change a whole lot of styles, and it takes a while to find them all. If it’s just a horizontal list of links at the top of the page that you want, it might be easier to code a new one from scratch.


But hey, the more popular frameworks out there, Bootstrap in particular, have a lot of customization tools, right? Yes, and that’s a great thing, but the default options don’t give you quite enough room to work.


Simply put, if your focus is on creativity, a massive framework is probably not the way to go. Sure, you can hack it, but that will take a lot of time.


One more problem that I’ve run into: JavaScript incompatibilities. As a guy who isn’t really a programmer, this was painful. 


Specifically, there was this one time when I tried to integrate a couple of jQuery plugins into a design based on Foundation. This isn’t a deal breaker all on its own, but it’s more time spent debugging.


Of course, this was some time last year. I honestly don’t know what would happen if I tried the same thing with the new versions of the same framework and plugins, but it is still something to consider.


In summary, there are times when frameworks simply aren’t the answer. This is where the toolkit comes in, and you should have one.


A toolkit, in the context of this article, is a self-collected and curated set of tools, snippets, plugins, and resources that allow you to code your projects that much faster. People will often find these resources over time and become attached to them. It’s a personal thing, and you really have to make your own.


Similarities

Toolkits and frameworks are both largely made up of code designed to help you get started.Their job is to make your life easier, but they can’t and shouldn’t do all of the work for you.They both need to be maintained and updated to reflect the latest technologies in play. 

Differences

Toolkits don’t make any design or structural assumptions, frameworks often do.Toolkits are usually made up of things that come from entirely different sources.It’s not just code, toolkits can include software, bookmarked links, and so on.Toolkits usually don’t have any “default files”, leaving you to pick and choose.

The advantage of a toolkit over a framework is its sheer versatility. As stated before, in projects where you intend to push the boundaries design-wise, a framework is often just too cumbersome.


That same quality is also the framework’s downfall in small-to-medium size projects. Are you building a promotional landing page? A one-page website? A simple blog? Then a framework is probably just unnecessary. You’re better off starting from scratch, and making every detail of the project yours. 


I’d go so far as to say — this is just my opinion — that most content-driven websites don’t need a fully-fledged framework. The exception would be for massive sites, like ars technica for example. For something that big you should use a framework, but you should probably develop it from scratch yourself to meet the website’s exact needs.


Where frameworks like Bootstrap and Foundation truly shine is in web application development and app-driven websites. It is in these projects that the relatively rigid constraints come in handy, instead of slowing you down.


Making your own toolkit is a question of time, patience, and experience. I mean, sure, you could just go and do a search for “web design resources”. You’d get thousands upon thousands of hits, and in a couple of hours you could download more bits of code than you could ever possibly use.


But that is not a toolkit. That is a library that you’re never going to touch, because sorting through it would take far too long. We’re busy people, so I’ve taken a more organic approach to this: when I encounter a problem, I Google it.


Snippets are often too long to memorize, so if I find myself repeatedly searching for the same thing, I add it to my toolkit. The same goes for software: if it’s something you know you’re going to use a lot, you add it.


That’s not to say that you should never set aside time to just experiment with some new “toys”… you should. If you hear about a particular resource that could change the way you work for the better, by all means check it out. But remember that toolkits are better kept relatively small. You should focus on keeping only what you require to meet the needs that you encounter regularly.


Again, I’ll reiterate that toolkits are something you have to make yourself, to meet your own needs. Still, I’m going to list the things in my toolkit to give you a better idea of what to look for as you create your own.


CSS pre-processors like LESS and SASS do two things:  

They extend CSS basic functionality with variables, mixins, nested selectors, etc.They make coding CSS faster.

If you haven’t already tried coding CSS with a pre-processor, I urge you to do so now. Right now. I’ll wait.


A well-organized list of bookmarks can be greatly beneficial when you need something that you can’t save on your local hard drive. I bookmark things like CSS3 generators, sprite generators, color scheme creators, and other tools that help me to quickly accomplish tasks that take just that much longer when you do them by hand.


Grid systems are so 2000s. Ever since responsive web design became an actual thing, grid systems have become increasingly complex in order to meet the needs of myriad devices.


And what if you need a custom grid system? You could hit up one of the many online responsive grid system generators, but they’re limited.


The solution comes in the form of semantic.gs. Now, while its own author calls it a grid system, I choose to call it a layout engine, because it’s not one grid. It’s a tool based on CSS pre-processing (you can use it with LESS, SASS, and Stylus), and it allows you to generate any grid you like, fixed-width or responsive, on the fly.


All you have to do is change some numbers in a .less (or SASS, etc) file, and go.


Emmet is a collection of plugins that turn abbreviations into full lines of code, in both HTML and CSS.


Basically, it turns this:

div>ul>li*3>a

Into this:













How cool is that?


Snippets are those little bits of code that you keep using over and over again because they’re just so useful and you love them to bits, and you want to remember them all but you just can’t.


Any good text editor usually has a way to store and easily retrieve them. Right now, my favorite bunch of snippets would have to be this one for WordPress. WordPress’ template functions and options for functions.php can be difficult to remember, so this is a life saver.


As I said before, I’m not a real programmer. So when any kind of advanced animation or UI functionality is required, but not so much to make a framework worth the trouble, I turn to individual plugins.


Some of my favorites are: 

Scrollto.js: a smooth scrolling script.idTabs: for when you need any sort of tabbed UI.Supersized: for when you need a whole page slideshow.ResponsiveSlides.js: what the name says. It’s a responsive image slider. What more could you want?

It’s never too soon to have your own personal library of useful things.


What tools would you like to see in your toolkit? What resources couldn’t you live without? Let us know in the View the original article here

Featured on Offscreen Issue #2


I'm honored to announce that I've been featured on Offscreen magazine issue #2. Offscreen launched its first issue in Feburary 2012 and quickly became well recognized in the design community. So I'm proud to be selected in the logbook section (thanks Kai Brach). I have five copies of Offscreen #2 to giveaway. As usually, post a comment in this post before Jul 27, 2012 to enter the giveaway draw.


Update: The contest is closed and the winners are: Tim, Benedikte, Shen, Hazel, and Mana.

The comment must be submitted before Jul 27, 2012. One entry per person.5 winners will be selected randomly. Each winner will get a copy of Offscreen #2offscreen 2 Share ? Tweet PSD 2 HTML Wow, impressive web design tool: macaw.co/peek/
5 days agoA 'lorem ipsum' generator for Canadians: canadipsum.com
6 days agoCheck @themify new Flat theme (packed with drag & drop Builder, animation effects, shortcodes + many post types) - bit.ly/13vAdxF
12 days agoWordPress Themes

Check out the WordPress themes that I've designed at Themify. Use 'WDW' Themify coupon code to save 20%.

Art Prints

Buy my art prints on Society6. Available in canvases, posters, tshirts, hoodies, and laptop skins and iPhone cases.

Stock Icons

My vector icons are also available for sale at IconDock. Use 'WDW' coupon code to save 20%.

Interactive World JavaScript Map May 30, 2013

Two Free 2013 FITC Conference Tickets Mar 22, 2013

Jan 24, 2013

rĂ©fĂ©rencement grenoble: JQuery is sooooo powerful ! Added with some others Gmaps plu… kombi: it is easy to change the location's attributes. Upon hover, … DymoLabels: Excellent tutorials. Java script will be the next generation…

Web Designer Wall is all about design, ideas, web trends, and tutorials. It is designed and maintained by Nick La, who also runs N.Design Studio, Themify, IconDock, and Best Web Gallery.

© Web Designer Wall 2013

Back to top


View the original article here

No More Annoying Facebook Ads! Well, sort of…

Screen Shot 2013-06-14 at 11.05.08 AMFacebook users rejoice! The company announced today that it will be scrapping Sponsored Search Results, with the removal taking full effect later in July. Don’t get too excited though, this change is only temporary. Facebook plans to continue its use of “search advertising,” including the annoying right-hand column ads currently found on result pages as well as Bing’s search ads.


According to a statement issued today by Facebook, “starting in July advertisers will no longer be able to buy Sponsored Results.”


Eliminating redundancy appears to be one focus of this change. As Facebook explains, “We’ve seen that most marketers were buying Sponsored Results to advertise their apps and games and we already offer mobile app install ads and Page post link ads on desktop to achieve these same goals.” For example, below is an example of a Sponsored Result. Look familiar?


sponsered facebook ads


When first introduced, Facebook’s Sponsored Results were considered competition to Google’s search ads. However, removing this service will also allow Facebook to focus on further developing its “Graph Search,” a feature launched in January of this year. Ditching Sponsored Results is just one of many attempts Facebook is implementing to refine ad offers in order to perfect advertisements within “Graph Search” going forward. Surprisingly this is not the only major shift Facebook has endured this week. Find out more about Facebook’s new features, such as the addition of hashtags in our previous post, “Facebook Launches Hashtags and #ItWillChangeYourLife.”


Happy? Sad? Don’t care? How do you feel about the removal of sponsored ads on Facebook? Comment below and let us know what you think.


Sources:


Sterling, Greg. “Facebook To End Sponsored Search Ads — For Now.” Search Engine Land. N.p., 13 June 2013. Web. 13 June 2013. http://searchengineland.com/facebook-to-end-sponsored-search-ads-for-now-163191?utm_campaign=tweet.


Wasserman, Todd. “Mashable.” Mashable. N.p., 13 June 2013. Web. http://mashable.com/2013/06/13/facebook-nixes-sponsored-results-ads/.


By: Peter Kirby

Tweet Posted on: June 13th, 2013 by Peter Kirby

View the original article here

CSS3 – Transitions

This is a fun little feature, just as long as you are Not trying to view it with Internet Explorer. Unfortunately, IE does not support the CSS3 transition property (yet?). I know, I was shocked, too… The other main browsers support it, but Firefox 4, Chrome, and Safari require a pre-fix:

Chrome – -webkit- (same as Safari)Firefox 4 – -moz-Opera – -o-Safari – -webkit- (same as Chrome)

Firefox 4 was released in February 2010, and as I’m writing this – December 2012 – we’re on Firefox version 17, I would not worry about this old version any longer, but for those of you who want to cover all bases, add a line of -moz- to your CSS.


There are four properties related to transition:

property – addresses the property that is being transitionedbackground color and positionborder color, spacing, and widthclipcolorcropfont size and weightletter and word spacing and line heightmargin and paddingmax and min height and widthopacityoutline color, offset, and widthtext indent and shadowvertical-align and z-indexvisibilityduration – sets the amount of time, in seconds (s), the transition takes. The default is ’0' so without this information, the transition effect is lost.timing-function – Sets the pace of the transition. linear – same speed from start to finishease – slow start and finish, faster in the middleease-in – slow start, faster finishease-out – faster start, slow endcubic-bezier – allows to more specifically set start and end speed of the transition by defining four values between zero and one: (.5, .8, .3, .6)delay – sets when the transition starts. The default is ’0', which starts it immediately, delays can be set in seconds (s) or milliseconds (ms).

So, all browser-required pre-fixes aside, the basic CSS could look like this:

{transition-property: width;transition-duration: 3s;transition-function: ease;transition-delay: 1s;}

Considering that we need 3 (or 4, if you want to cover FX4) lines for each of these properties, this could get quite cumbersome. Thank God (or whoever sets these specifications), there are shortcuts.

{transition: width 3s ease 1s;}

or, if considering all the browsers:

{transition: width 3s linear 2s;-moz-transition: width 3s linear 2s;-webkit-transition: width 3s linear 2s;-o-transition: width 3s linear 2s;}

See a few examples in action HERE


If you have any questions about this tutorial or run into trouble trying it yourself, post your question/problem in the Killersites Forum for help.


Tags: css3, transitions

This post was written by: Andrea Barnett

This entry was posted on Monday, December 24th, 2012 at 8:45 pm and is filed under HTML5 and CSS3, Web Design Basics. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.


View the original article here

Introduction To Photoshop Scripting

Automation is useful in the work of every designer. It saves precious time on repetitive tasks and helps us solve certain problems more quickly and easily.


You can automate your workflow in Photoshop with actions, which are pretty popular and which most of you already know about and use. Today, we’ll introduce you to an advanced automation technique: scripting. All you need for this is basic knowledge of JavaScript, which some of us Web designers already have.


I’ve known about Photoshop scripts for years but decided to really dive in a few months ago. I had avoided it because I thought it was the domain of smart math-minded programmers. I was wrong, and today I’ll show that, although it requires some basic programming skills, scripting isn’t hard to grasp.


But first, we have to answer the obvious question.


Why should we would learn to script if Photoshop already has pretty nice actions? The answer is interactivity. When you use an action, you can’t really control how it behaves in different situations; it is like a videotape that just keeps playing again and again without any change.


Why We Need Scripts?


A script is more dynamic; its behavior changes according to the parameters you input or the context of its application. Sounds useful, no?


You don’t have to be an advanced programmer to be able to write scripts; I’m just a graphic designer, like most of you. But you should at least have a basic understanding of JavaScript and some experience with properties and methods to get the most out of this article.


Requirements


If you are not familiar with JavaScript at all, fear not! There are plenty of places to learn the basics of programming. Codecademy, for example, has pretty neat interactive lessons.


I work in Adobe Photoshop CS5, but everything we’ll cover applies to newer versions, too; Adobe hasn’t made any major updates to its scripting API since CS5. I will refer to the latest version of the scripting documentation, though, which is CS6.


When you record actions in Photoshop, you set the order of the steps to achieve a certain result — that’s your algorithm. Then, you press “Record” and replicate them in Photoshop one by one. Scripting is similar, but instead of doing these steps in Photoshop, you write them down as lines of code. Most actions that you do in Photoshop have their own script equivalent as a function.


Start here


Let’s say you are creating an action that scales a document to 150% of its original size. You’d go through these steps:

Open Image ? Image Size.Enter 150% in width and height.Hit “OK.”

The same process with a script would look like this:

Call the application: appTarget a document: activeDocumentCall the function to resize the image: resizeImage(width, height)

And the code would look like this:

app.activeDocument.resizeImage("150%", "150%");

There are three ways to write scripts for Photoshop: using AppleScript on Mac, VBScript on Windows or JavaScript on either platform. I use the third because it is cross-platform and I already have some experience with it.


Adobe has its own utility for writing scripts, called ExtendedScript Toolkit.


Adobe ExtendedScript Toolkit
The main window for Adobe’s ExtendedScript Toolkit. (View large version.)


The toolkit comes with Photoshop, and you can find it in the following folder:

Mac OS X
/Applications/Utilities/Adobe Utilities CS6/ExtendScript Toolkit CS6/Windows
C:\Program Files\Adobe\Adobe Utilities - CS6\ExtendScript Toolkit CS6
(or Program Files (x86) for 64-bit machines)

The user interface of the ExtendedScript Toolkit is pretty straightforward. To start writing scripts, first select the target application in the drop-down menu. If Photoshop is running, then look for the green chain icon near the drop-down menu:


Application Select


Now you can write something like this:

alert("Hello Photoshop!");

Press cmd + R (or just hit the “Play” button in the toolbar) to run your script. ExtendedScript Toolkit should switch to Photoshop and show an alert box:


Hello Photoshop!


ExtendedScript Toolkit has some other neat features for debugging scripts, but this is enough for this article. You can learn more about how to use it by going to Help ? JavaScript Tools Guide.


You can use any plain-text editor to write a script; just save it as a .jsx file. To run it, you’ll have to go to File ? Scripts ? Browse in Photoshop and select it. Alternatively, just open the script file with Photoshop. You can also add a line of code at the top of the script so that the file always opens in Photoshop:

#target photoshop

Save your scripts in the Photoshop/Presets/Scripts/ directory, and access them with File ? Scripts. You can also set up a hotkey; just go to Edit ? Keyboard Shortcuts, navigate to File ? Scripts ? [your script’s name], and set the shortcut you want.


ExtendedScript Toolkit can run and debug code from the integrated development environment, and it has an object model viewer built in, which is useful. So, I recommend using the toolkit to write your scripts. Unfortunately, the Mac version crashes sometimes, so keep that in mind.


To make writing scripts easier, you should understand how things relate to each other in Photoshop’s Document Object Model (DOM). Understanding it is not so hard if you look at Photoshop itself. The main object in Photoshop’s DOM is the application. In the application, we have a collection of documents that are currently open in Photoshop.


Each document contains elements — such as layers (called ArtLayers), groups of layers (LayerSets), channels, history states and so on — just like in a regular PSD document.


A simplified visualization of Photoshop’s DOM is below. A more detailed containment hierarchy can be found on page 12 of “Adobe Photoshop CS6 Scripting Guide” (PDF).


Simplified visualization of Photoshop API
A simplified visualization of Photoshop’s DOM.


Each of these objects has its own properties and methods that you can work with. For example, to change the opacity of the selected layer in a document, you would go to Application ? Document ? Layer ? Opacity and set the desired value. The code would look like this:

app.activeDocument.activeLayer.opacity = 50;

As you may have guessed, activeDocument and activeLayer determine the currently selected document and layer.


You can find descriptions of most objects and their properties and methods in “Adobe Photoshop CS6 JavaScript Scripting Reference” (PDF), or in ExtendedScript Toolkit by going to Help ? Object Model Viewer.


Let’s see how this works in a real-world example. In this next section, we’ll write our own script based on an action.


A few years ago at Christmas time, I had an idea for an action to help me draw snowflakes.

Draw one stem of the snowflake with a pattern.

Step One

Duplicate the stem, and rotate it a few degrees.

Step Two

Repeat the second step until you have a full circle.

Step Three


Duplicating and rotating each stem manually is tedious, so I came up with an action to automate it. The algorithm looks like this:

Duplicate the stem.Rotate it by however many degrees you’ve chosen, using the Transform tool.Duplicate the layer.Use the “Repeat Transform” function.Repeat steps 4 and 5 until you have a full circle.

Pretty neat. But the action had a disadvantage: You can set only a certain number of stems for the snowflake, according to the number of degrees you set in third step of the algorithm.


Back when I wasn’t familiar with scripting, I just made a few versions of the action, each of which produced a snowflake with a different number of stems.


Today, we will remaster this action as a dynamic script that takes your input on the number of stems. Let’s get started!


When you start writing a script, defining the algorithm first before digging into the code itself is always a good idea. In our case, the algorithm will work like this:

Ask the user to enter the number of stems.Calculate the rotation angle.Duplicate and rotate the layer by the number set in the first step.

Let’s start with saving the current or selected layer to a variable for further use:

// Save selected layer to variable:var originalStem = app.activeDocument.activeLayer;

Note that in JavaScript, you can mark a line with double slashes (//) to make it a comment. Comments are used to describe parts of code for future reference and don’t affect the behavior of the script.


Let’s move on to our algorithm now.


We can take input from the user with the prompt(message, default value[, title]) function. This function shows a dialog box with the message and an input field that contains the default value. When the user hits “OK,” the function returns the inputted value; so, we have to save it to the variable to be able to be used.

// Ask user for input by showing prompt box and save inputted value to variable:var stemsAmount = prompt("Processing \""+originalStem.name+"\"\nHow many stems do you need?", 12);

Note that I used originalStem.name in the message, so the dialog box will show the name of selected layer.


On Mac OS X, the first line of the message is in bold and functions as the title. So, our main message should be on the second line. To make a new line, type \n.


In Windows, you can specify a third argument in the function to set the title:

// Ask user for input by showing prompt box and save inputted value to variable:var stemsAmount = prompt("How many stems do you need?", 12, "Processing "+originalStem.name);

If we run the code in Photoshop, it will show this dialog box:


Prompt dialog


When the user hits “OK,” the inputted value will be saved to the stemsAmount variable. If the user clicks “Cancel,” then the function will return a null value. We’ll use this later.


To calculate the rotation angle, we have to divide 360 degrees (a full circle) by the number of stems:

// Calculate the rotation anglevar angle = 360 / stemsAmount;

Now we have everything we need to make duplicates of our stem. To do this, we’ll use the for loop. It lets us repeatedly run lines of code as many times as we’d like. Our loop will look like this:

for(var i = 1; i < stemsAmount; i++){// This code will run "stemAmount - 1" of times};

Note that the first instance of an object in programming has the value of 0, but because our first layer is already on the canvas, we’re starting the loop from 1 instead.


To duplicate and rotate our layer, we will use the duplicate() and rotate(angle, AnchorPosition) methods: the number of layers to be rotated in angle multiplied by the indexed number of duplicates. AnchorPosition determines the point around which the layer will rotate. You can see this point when you use the Transform tool in Photoshop — it looks like a small circle with a crosshair. In scripting, it has only 9 specified values — i.e. the 9 positions of the anchor point:


AnchorPosition visualization


In our case, it is the bottom center of the layer, BOTTOMCENTER. Photoshop uses a lot of other constants here and there in some of the functions, which you can find on page 197 of “Adobe Photoshop CS6 JavaScript Reference” (PDF).


So, our loop will look like this:

// Duplicate and rotate layers:for(var i = 1; i < stemsAmount; i++){// Duplicate original layer and save it to the variable var newStem = originalStem.duplicate();// Rotate new layernewStem.rotate(angle * i, AnchorPosition.BOTTOMCENTER);};

And the completed code will look like the following. You can try to run it.

// Save selected layer to variable:var originalStem = app.activeDocument.activeLayer;// Ask user for input by showing prompt box and save inputted value to variable:var stemsAmount = prompt("Processing \""+originalStem.name+"\"\nHow many stems do you need?", 12);// Calculate the rotation angle:var angle = 360 / stemsAmount;// Duplicate and rotate layers:for(var i = 1; i < stemsAmount; i++){// Duplicate original layer and save it to the variablevar newStem = originalStem.duplicate();// Rotate new layernewStem.rotate(angle * i, AnchorPosition.BOTTOMCENTER); };

I’ll usually try to achieve the main goal with a script, and when everything works correctly, I’ll start to refine the code. In our case, we have to make sure that the user inputs a valid number in the prompt box — i.e. a positive integer, greater than one.


Also, to prevent Photoshop from going crazy, we will restrict the number of stems — let’s say, to 100. To do this, we will use a while loop to show the user an error message in the event of an invalid submission, and the prompt box will continue to be shown until the user enters a valid value or hits the “Cancel” button (remember that the prompt returns null if the user hits “Cancel”).


The new code looks like this:

// Save selected layer to variable:var originalStem = app.activeDocument.activeLayer;// Ask user for input by showing prompt box and save inputted value to variable:var stemsAmount = prompt ("Processing \""+originalStem.name+"\"\nHow many stems do you need? (From 2 to 100)", 12);// Check that user entered a valid number and, if invalid, show error message and ask for input againwhile(isNaN(stemsAmount) || stemsAmount <= 0 || stemsAmount > 100){// If user clicks "Cancel" button, then exit loopif(stemsAmount == null) break;// Show error message…alert("Please enter number in range from 2 to 100");// …and ask for input againstemsAmount = prompt("Processing \""+originalStem.name+"\"\nHow many stems do you need? (From 2 to 100)", 12);};// Run the copying processif(stemsAmount != null){ // Calculate the rotation anglevar angle = 360 / parseInt(stemsAmount);// Duplicate and rotate layers:for(var i = 1; i < stemsAmount; i++){// Duplicate original layer and save it to the variablevar newStem = originalStem.duplicate();// Rotate new layernewStem.rotate(angle * i, AnchorPosition.BOTTOMCENTER);};};

As you may have noticed, we’re using the isNaN(value) function, which returns true if value is “not a number” and parseInt(value) to convert the value to an integer when we calculate the rotation angle.


The next thing we will do is manage the layers, renaming our new layers by adding an index to them. Also to make sure that we do not mess up document’s layers, let’s place our stems in a group.


Renaming the layers is not a hard task. We will just use the name property of the layer and add an index number to it:

// Add index to new layersnewStem.name = originalStem.name + " " + (i+1);

A group in Photoshop’s API is called a LayerSet and we can access all groups of the document by calling the layerSets property. To add a new group to a document, we have to call the layerSets’ method add():

// Create a group for stemsvar stemsGroup = app.activeDocument.layerSets.add();stemsGroup.name = originalStem.name + " ("+stemsAmount+" stems)";

Then, to add a layer to the group, we will use the move(relativeObject, ElementPlacement) function. Note that the move() function moves a layer in the layer stack, not on the canvas. (You can move a layer on the canvas with the translate(deltaX[, deltaY]) function.)


ElementPlacement is another constant, this one determining how we will place our layer relative to… well, relativeObject. In our case, we will use ElementPlacement.INSIDE to place the original layer inside a group:

// Place original layer in grouporiginalStem.move(stemsGroup, ElementPlacement.INSIDE);

We will place each new copy of the layer at the bottom of all layers in the group using ElementPlacement.PLACEATEND. The result is all of our layers arranged in ascending order, the first layer at the top and the last at the bottom:

// Place new layer inside stems groupnewStem.move(stemsGroup, ElementPlacement.PLACEATEND);

You can read more about the ElementPlacement constant on page 202 of “Adobe Photoshop CS6 JavaScript Reference” (PDF).


That’s it! RotateMe.jsx is done. Our final code looks like this:

// Save selected layer to variable:var originalStem = app.activeDocument.activeLayer;// Ask user for input by showing prompt box and save inputted value to variable:var stemsAmount = prompt ("Processing \""+originalStem.name+"\"\nHow many stems do you need? (From 2 to 100)", 12);// Check that user entered a valid number and, if invalid, show error message and ask for input againwhile(isNaN(stemsAmount) || stemsAmount <= 0 || stemsAmount > 100){// If user clicks "Cancel" button, then exit loopif(stemsAmount == null) break;// Show error message…alert("Please enter number in range from 2 to 100");// …and ask for input againstemsAmount = prompt("Processing \""+originalStem.name+"\"\nHow many stems do you need? (From 2 to 100)", 12);};// Run the copying processif(stemsAmount != null){ // Calculate the rotation anglevar angle = 360 / parseInt(stemsAmount);// Create a group for stemsvar stemsGroup = app.activeDocument.layerSets.add();stemsGroup.name = originalStem.name + " ("+stemsAmount+" stems)";// Place original layer in grouporiginalStem.move(stemsGroup, ElementPlacement.INSIDE);// Duplicate and rotate layers:for(var i = 1; i < stemsAmount; i++){// Duplicate original layer and save it to the variablevar newStem = originalStem.duplicate();// Rotate new layernewStem.rotate(angle * i, AnchorPosition.BOTTOMCENTER);// Add index to new layersnewStem.name = originalStem.name + " " + (i+1);// Place new layer inside stems groupnewStem.move(stemsGroup, ElementPlacement.PLACEATEND);};// Add index to the original layeroriginalStem.name += " 1";};

That wasn’t too hard, was it?


Finish


Now you can put it in the Photoshop/Presets/Scripts/ folder and run it by going to File ? Scripts in Photoshop. Using different shapes with different values can yield interesting results:



As you can see from the number of links in the resources section below, there’s much more to say about scripting than can fit in an introductory article. But I hope the little that we’ve described today piques your interest and shows how powerful and helpful scripting is.


Community Power!


If you decide to dive into it, let’s learn together and share our experience. Ask your questions and share what you’ve done in the comments. If you are not a coder, consider leaving an idea for a script; maybe another reader will make it happen.


Let’s make Photoshop more useful together!


I’m still learning about Photoshop scripts, too, and here are some resources that are helping me along the way:

“Adobe Photoshop Scripting,” Adobe Developer Connection
All of the documentation and utilities for scripting.“Adobe Introduction to Scripting” (PDF), Adobe
Here are the basics on scripting for Adobe applications. The nice thing about scripting for Photoshop is that you can apply your knowledge to other Adobe products; you just need to learn the application’s DOM, and you’ll be ready to go.“Adobe Photoshop CS6 Scripting Guide” (PDF), Adobe
In this introductory guide to scripting for Photoshop, you’ll find the basics on getting started with scripting.“Photoshop CS6 JavaScript Reference” (PDF), Adobe
This describes all of the objects and their functions and methods that you can use in scripting for Photoshop. This is one of the documents I use most when writing scripts.“JavaScript,” Mozilla Developer Network
Here are answers to all kinds of questions about general JavaScript functions and usage.“JavaScript Tools Guide” (PDF), Adobe
This has basic information about ExtendedScript Toolkit and some advanced techniques, such as file system access and ScriptUI and working with XML, sockets and more.PS-Scripts
An independent forum about scripting for Photoshop. I haven’t signed up to participate in discussions, but it has plenty of answered questions and solved problems to discover.Photoshop Scripting, Adobe Community
Adobe’s official forum for Photoshop scripting has some good discussion on problems encountered by users.

(al) (ea)

Kamil Khadeyev

Kamil Khadeyev is a graphic designer specializing on icon and UI design. You can see his latest works at his Dribbble account. Kamil also has a Blog where he writes about design related themes, such as workflow tips, scripts for Adobe Photoshop and more.


Every second Thursday we send out our lovely email newsletter with useful tips and techniques, recent articles and upcoming events. Thousands of readers have signed up already. Why don't you sign up, too, and get a free Smashing eBook as well?

Yay! You've decided to leave a comment. That's fantastic! Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let's have a personal and meaningful conversation instead. Thanks for dropping by!


View the original article here

Free 90 days of Moz’s Pro SEO tools

 Business can be a lot like an Olympic race; being world class isn’t good enough, to be successful you have to out-perform your competitors.


Nowhere is that more true than search engine optimization, when results are quite literally about your position in a league table. You simply cannot win by focusing exclusively on your own site, you have to know what your competitors are doing.


One of our favorite ways of staying on top of the competition is Moz — you may know it by its old name SEOMoz — but it’s still the indispensable tool that it’s always been. Moz gives you the ability to treat SEO like the competition it is, to monitor your rivals, learn when you’re gaining on them, when you’re slipping back, and when you’re leaving them in your wake.


Have you looked at a competitor and thought, “How are they doing so well?”. With Moz you don’t need to wonder anymore, competitor analytics show you exactly what your rivals are doing, how they’re being picked up and what you can do to match, and even exceed them. Of course, knowing how your site is performing is only half the battle, if you want to address problems — or avoid creating new ones — you need to know the why as well. Moz has several tools to automatically assess your site and score you on your SEO effectiveness.


Link Research & Analysis lets you inspect your competitor’s links, and social data. If they’re doing it, and succeeding as a result, you need to start doing it to.


Open Site Explorer will track your backlinks, as well as your competitors. An influential blog driving traffic to your competitor? Discover the link, check what their interest is, and approach them yourself.


As well as backlinks, it’s important to spot any other mentions. Social Media can be a minefield for many brands, with many users trolling behind your back; Fresh Web Explorer shows you all mentions, good and bad so you can respond accordingly.

moz-003

Moz focuses on showing you not just the current state of play, but your performance over time, so you can judge trends, monitor the affects of changes and keep your results moving upwards.


Link analysis helps you keep an eye on your competitor’s links and helps you find opportunities to expand your own link range. This is increasingly vital as Google push their emphasis to natural links.


How is your site performing on Google right now? How about Bing? Not sure? Then you need Rank Tracking, which will tell you exactly where you are right now.


On-Page Optimization will look at your site and grade it for SEO effectiveness. No more puzzling over the reason you’ve dropped to page 2.


How sure are you your site is accessible to crawlers? It’s amazing how many sites fall down on the basics, SEO Web Crawler will make sure yours isn’t one of them.

moz-002

Analysing social media is easy with Moz too. Watch who’s talking about you, and connect with power-users. Do you know the best time of day to tweet? You will with Moz, and that data helps you build lasting relationships for long-term social media success. Most importantly Moz shows you our social media impact in the context of your site.


Twitter Analytics analyses exactly when and who is online of your followers helping you to determine the best time of day to push out new posts. Ensuring that you get the best reception for your hard work.


Campaign Tracking is your one-stop-shop for whole campaigns. It’s a place to pull together all of your data and analyse your SEO footprint.

moz-001

But Moz isn’t just a toolset, it’s a fully rounded resource ideal for beginners and advanced SEO professionals alike.


Twice monthly training webinars lift the lid on SEO best practices and  teach you to fully understand the how and why of your site’s performance.


The Q&A Forum is the perfect place to find the answer to that question.


If it’s something you’re asking, chances are it’s been asked before. The answers are all here, you’ve just got to look.


Advanced Online Marketing Guides give you the professional view of SEO, and make sure that you know exactly how to out-perform your competitors.


The Moz SEO community is 300,000 strong and growing. Become a part of it and see your site’s performance really take off.


We’re thrilled to be able to say that the generous people at Moz have agreed to give WebdesignerDepot readers an amazing 90 days of free access to their Pro toolset — that’s almost $300 of SEO optimization at your fingertips!


Moz includes a plethora of great tools, and surprisingly, many are completely free for everyone, 365 days a year. Pro subscribers also get access to some of the best tools available for SEO: Fresh Web Explorer; Rank Tracker, On-Page Grader; and Keyword Analysis. It’s those Pro tools that you’re going to be able to use free of charge for 90 days.


All you’ve got to do to take advantage of this amazing offer is to sign up with Moz using this link and get ready to start winning the SEO race.


Have you taken advantage of this 90 days for free offer yet? Which of Moz’s tools are you most looking forward to trying? Let us know in the comments.


View the original article here