Entries by admin

Creating a Water-like Distortion Effect with Three.js

Original Source: http://feedproxy.google.com/~r/tympanus/~3/6vUN32q0wsA/

In this tutorial we’re going to build a water-like effect with a bit of basic math, a canvas, and postprocessing. No fluid simulation, GPGPU, or any of that complicated stuff. We’re going to draw pretty circles in a canvas, and distort the scene with the result.

We recommend that you get familiar with the basics of Three.js because we’ll omit some of the setup. But don’t worry, most of the tutorial will deal with good old JavaScript and the canvas API. Feel free to chime in if you don’t feel too confident on the Three.js parts.

The effect is divided into two main parts:

Capturing and drawing the ripples to a canvas

Displacing the rendered scene with postprocessing

Let’s start with updating and drawing the ripples since that’s what constitutes the core of the effect.

Making the ripples

The first idea that comes to mind is to use the current mouse position as a uniform and then simply displace the scene and call it a day. But that would mean only having one ripple that always remains at the mouse’s position. We want something more interesting, so we want many independent ripples moving at different positions. For that we’ll need to keep track of each one of them.

We’re going to create a WaterTexture class to manage everything related to the ripples:

Capture every mouse movement as a new ripple in an array.

Draw the ripples to a canvas

Erase the ripples when their lifespan is over

Move the ripples using their initial momentum

For now, let’s begin coding by creating our main App class.

import { WaterTexture } from ‘./WaterTexture’;
class App{
constructor(){
this.waterTexture = new WaterTexture({ debug: true });

this.tick = this.tick.bind(this);
this.init();
}
init(){
this.tick();
}
tick(){
this.waterTexture.update();
requestAnimationFrame(this.tick);
}
}
const myApp = new App();

Let’s create our ripple manager WaterTexture with a teeny-tiny 64px canvas.

export class WaterTexture{
constructor(options) {
this.size = 64;
this.radius = this.size * 0.1;
this.width = this.height = this.size;
if (options.debug) {
this.width = window.innerWidth;
this.height = window.innerHeight;
this.radius = this.width * 0.05;
}

this.initTexture();
if(options.debug) document.body.append(this.canvas);
}
// Initialize our canvas
initTexture() {
this.canvas = document.createElement(“canvas”);
this.canvas.id = “WaterTexture”;
this.canvas.width = this.width;
this.canvas.height = this.height;
this.ctx = this.canvas.getContext(“2d”);
this.clear();

}
clear() {
this.ctx.fillStyle = “black”;
this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
}
update(){}
}

Note that for development purposes there is a debug option to mount the canvas to the DOM and give it a bigger size. In the end result we won’t be using this option.

Now we can go ahead and start adding some of the logic to make our ripples work:

On constructor() add

this.points array to keep all our ripples
this.radius for the max-radius of a ripple
this.maxAge for the max-age of a ripple

On Update(),

clear the canvas
sing happy birthday to each ripple, and remove those older than this.maxAge
draw each ripple

Create AddPoint(), which is going to take a normalized position and add a new point to the array.

class WaterTexture(){
constructor(){
this.size = 64;
this.radius = this.size * 0.1;

this.points = [];
this.maxAge = 64;

}

addPoint(point){
this.points.push({ x: point.x, y: point.y, age: 0 });
}
update(){
this.clear();
this.points.forEach(point => {
point.age += 1;
if(point.age > this.maxAge){
this.points.splice(i, 1);
}
})
this.points.forEach(point => {
this.drawPoint(point);
})
}
}

Note that AddPoint() receives normalized values, from 0 to 1. If the canvas happens to resize, we can use the normalized points to draw using the correct size.

Let’s create drawPoint(point) to start drawing the ripples: Convert the normalized point coordinates into canvas coordinates. Then, draw a happy little circle:

class WaterTexture(){

drawPoint(point) {
// Convert normalized position into canvas coordinates
let pos = {
x: point.x * this.width,
y: point.y * this.height
}
const radius = this.radius;

this.ctx.beginPath();
this.ctx.arc(pos.x, pos.y, radius, 0, Math.PI * 2);
this.ctx.fill();
}
}

For our ripples to have a strong push at the center and a weak force at the edges, we’ll make our circle a Radial Gradient, which looses transparency as it moves to the edges.

Radial Gradients create a dithering-like effect when a lot of them overlap. It looks stylish but not as smooth as what we want it to look like.

To make our ripples smooth, we’ll use the circle’s shadow instead of using the circle itself. Shadows give us the gradient-like result without the dithering-like effect. The difference is in the way shadows are painted to the canvas.

Since we only want to see the shadow and not the flat-colored circle, we’ll give the shadow a high offset. And we’ll move the circle in the opposite direction.

As the ripple gets older, we’ll reduce it’s opacity until it disappears:

export class WaterTexture(){

drawPoint(point) {

const ctx = this.ctx;
// Lower the opacity as it gets older
let intensity = 1.;
intensity = 1. – point.age / this.maxAge;

let color = “255,255,255”;

let offset = this.width * 5.;
// 1. Give the shadow a high offset.
ctx.shadowOffsetX = offset;
ctx.shadowOffsetY = offset;
ctx.shadowBlur = radius * 1;
ctx.shadowColor = `rgba(${color},${0.2 * intensity})`;

this.ctx.beginPath();
this.ctx.fillStyle = “rgba(255,0,0,1)”;
// 2. Move the circle to the other direction of the offset
this.ctx.arc(pos.x – offset, pos.y – offset, radius, 0, Math.PI * 2);
this.ctx.fill();
}
}

To introduce interactivity, we’ll add the mousemove event listener to app class and send the normalized mouse position to WaterTexture.

import { WaterTexture } from ‘./WaterTexture’;
class App {

init(){
window.addEventListener(‘mousemove’, this.onMouseMove.bind(this));
this.tick();
}
onMouseMove(ev){
const point = {
x: ev.clientX/ window.innerWidth,
y: ev.clientY/ window.innerHeight,
}
this.waterTexture.addPoint(point);
}
}

Great, now we’ve created a disappearing trail of ripples. Now, let’s give them some momentum!

Momentum

To give momentum to a ripple, we need its direction and force. Whenever we create a new ripple, we’ll compare its position with the last ripple. Then we’ll calculate its unit vector and force.

On every update, we’ll update the ripples’ positions with their unit vector and position. And as they get older we’ll move them slower and slower until they retire or go live on a farm. Whatever happens first.

export lass WaterTexture{

constructor(){

this.last = null;
}
addPoint(point){
let force = 0;
let vx = 0;
let vy = 0;
const last = this.last;
if(last){
const relativeX = point.x – last.x;
const relativeY = point.y – last.y;
// Distance formula
const distanceSquared = relativeX * relativeX + relativeY * relativeY;
const distance = Math.sqrt(distanceSquared);
// Calculate Unit Vector
vx = relativeX / distance;
vy = relativeY / distance;

force = Math.min(distanceSquared * 10000,1.);
}

this.last = {
x: point.x,
y: point.y
}
this.points.push({ x: point.x, y: point.y, age: 0, force, vx, vy });
}

update(){
this.clear();
let agePart = 1. / this.maxAge;
this.points.forEach((point,i) => {
let slowAsOlder = (1.- point.age / this.maxAge)
let force = point.force * agePart * slowAsOlder;
point.x += point.vx * force;
point.y += point.vy * force;
point.age += 1;
if(point.age > this.maxAge){
this.points.splice(i, 1);
}
})
this.points.forEach(point => {
this.drawPoint(point);
})
}
}

Note that instead of using the last ripple in the array, we use a dedicated this.last. This way, our ripples always have a point of reference to calculate their force and unit vector.

Let’s fine-tune the intensity with some easings. Instead of just decreasing until it’s removed, we’ll make it increase at the start and then decrease:

const easeOutSine = (t, b, c, d) => {
return c * Math.sin((t / d) * (Math.PI / 2)) + b;
};

const easeOutQuad = (t, b, c, d) => {
t /= d;
return -c * t * (t – 2) + b;
};

export class WaterTexture(){
drawPoint(point){

let intensity = 1.;
if (point.age < this.maxAge * 0.3) {
intensity = easeOutSine(point.age / (this.maxAge * 0.3), 0, 1, 1);
} else {
intensity = easeOutQuad(
1 – (point.age – this.maxAge * 0.3) / (this.maxAge * 0.7),
0,
1,
1
);
}
intensity *= point.force;

}
}

Now we’re finished with creating and updating the ripples. It’s looking amazing.

But how do we use what we have painted to the canvas to distort our final scene?

Canvas as a texture

Let’s use the canvas as a texture, hence the name WaterTexture. We are going to draw our ripples on the canvas, and use it as a texture in a postprocessing shader.

First, let’s make a texture using our canvas and refresh/update that texture at the end of every update:

import * as THREE from ‘three’
class WaterTexture(){
initTexture(){

this.texture = new THREE.Texture(this.canvas);
}
update(){

this.texture.needsUpdate = true;
}
}

By creating a texture of our canvas, we can sample our canvas like we would with any other texture. But how is this useful to us? Our ripples are just white spots on the canvas.

In the distortion shader, we’re going to need the direction and intensity of the distortion for each pixel. If you recall, we already have the direction and force of each ripple. But how do we communicate that to the shader?

Encoding data in the color channels

Instead of thinking of the canvas as a place where we draw happy little clouds, we are going to think about the canvas’ color channels as places to store our data and read them later on our vertex shader.

In the Red and Green channels, we’ll store the unit vector of the ripple. In the Blue channel, we’ll store the intensity of the ripple.

Since RGB channels range from 0 to 255, we need to send our data that range to normalize it. So, we’ll transform the unit vector range (-1 to 1) and the intensity range (0 to 1) into 0 to 255.

class WaterEffect {
drawPoint(point){

// Insert data to color channels
// RG = Unit vector
let red = ((point.vx + 1) / 2) * 255;
let green = ((point.vy + 1) / 2) * 255;
// B = Unit vector
let blue = intensity * 255;
let color = `${red}, ${green}, ${blue}`;

let offset = this.size * 5;
ctx.shadowOffsetX = offset;
ctx.shadowOffsetY = offset;
ctx.shadowBlur = radius * 1;
ctx.shadowColor = `rgba(${color},${0.2 * intensity})`;

this.ctx.beginPath();
this.ctx.fillStyle = “rgba(255,0,0,1)”;
this.ctx.arc(pos.x – offset, pos.y – offset, radius, 0, Math.PI * 2);
this.ctx.fill();
}
}

Note: Remember how we painted the canvas black? When our shader reads that pixel, it’s going to apply a distortion of 0, only distorting where our ripples are painting.

Look at the pretty color our beautiful data gives the ripples now!

With that, we’re finished with the ripples. Next, we’ll create our scene and apply the distortion to the result.

Creating a basic Three.js scene

For this effect, it doesn’t matter what we render. So, we’ll only have a single plane to showcase the effect. But feel free to create an awesome-looking scene and share it with us in the comments!

Since we’re done with WaterTexture, don’t forget to turn the debug option to false.

import * as THREE from “three”;
import { WaterTexture } from ‘./WaterTexture’;

class App {
constructor(){
this.waterTexture = new WaterTexture({ debug: false });

this.renderer = new THREE.WebGLRenderer({
antialias: false
});
this.renderer.setSize(window.innerWidth, window.innerHeight);
this.renderer.setPixelRatio(window.devicePixelRatio);
document.body.append(this.renderer.domElement);

this.camera = new THREE.PerspectiveCamera(
45,
window.innerWidth / window.innerHeight,
0.1,
10000
);
this.camera.position.z = 50;

this.touchTexture = new TouchTexture();

this.tick = this.tick.bind(this);
this.onMouseMove = this.onMouseMove.bind(this);

this.init();

}
addPlane(){
let geometry = new THREE.PlaneBufferGeometry(5,5,1,1);
let material = new THREE.MeshNormalMaterial();
let mesh = new THREE.Mesh(geometry, material);

window.addEventListener(“mousemove”, this.onMouseMove);
this.scene.add(mesh);
}
init(){
this.addPlane();
this.tick();
}
render(){
this.renderer.render(this.scene, this.camera);
}
tick(){
this.render();
this.waterTexture.update();
requrestAnimationFrame(this.tick);
}
}
Applying the distortion to the rendered scene

We are going to use postprocessing to apply the water-like effect to our render.

Postprocessing allows you to add effects or filters after (post) your scene is rendered (processing). Like any kind of image effect or filter you might see on snapchat or Instagram, there is a lot of cool stuff you can do with postprocessing.

For our case, we’ll render our scene normally with a RenderPass, and apply the effect on top of it with a custom EffectPass.

Let’s render our scene with postprocessing’s EffectComposer instead of the Three.js renderer.

Note that EffectComposer works by going through its passes on each render. It doesn’t render anything unless it has a pass for it. We need to add the render of our scene using a RenderPass:

import { EffectComposer, RenderPass } from ‘postprocessing’
class App{
constructor(){

this.composer = new EffectComposer(this.renderer);
this.clock = new THREE.Clock();

}
initComposer(){
const renderPass = new RenderPass(this.scene, this.camera);

this.composer.addPass(renderPass);
}
init(){
this.initComposer();

}
render(){
this.composer.render(this.clock.getDelta());
}
}

Things should look about the same. But now we start adding custom postprocessing effects.

We are going to create the WaterEffect class that extends postprocessing’s Effect. It is going to receive the canvas texture in the constructor and make it a uniform in its fragment shader.

In the fragment shader, we’ll distort the UVs using postprocessing’s function mainUv using our canvas texture. Postprocessing is then going to take these UVs and sample our regular scene distorted.

Although we’ll only use postprocessing’s mainUv function, there are a lot of interesting functions you can use. I recommend you check out the wiki for more information!

Since we already have the unit vector and intensity, we only need to multiply them together. But since the texture values are normalized we need to convert our unit vector from a range of 1 to 0, into a range of -1 to 0:

import * as THREE from “three”;
import { Effect } from “postprocessing”;

export class WaterEffect extends Effect {
constructor(texture) {
super(“WaterEffect”, fragment, {
uniforms: new Map([[“uTexture”, new THREE.Uniform(texture)]])
});
}
}
export default WaterEffect;

const fragment = `
uniform sampler2D uTexture;
#define PI 3.14159265359

void mainUv(inout vec2 uv) {
vec4 tex = texture2D(uTexture, uv);
// Convert normalized values into regular unit vector
float vx = -(tex.r *2. – 1.);
float vy = -(tex.g *2. – 1.);
// Normalized intensity works just fine for intensity
float intensity = tex.b;
float maxAmplitude = 0.2;
uv.x += vx * intensity * maxAmplitude;
uv.y += vy * intensity * maxAmplitude;
}
`;

We’ll then instantiate WaterEffect with our canvas texture and add it as an EffectPass after our RenderPass. Then we’ll make sure our composer only renders the last effect to the screen:

import { WaterEffect } from ‘./WaterEffect’
import { EffectPass } from ‘postprocessing’
class App{

initComposer() {
const renderPass = new RenderPass(this.scene, this.camera);
this.waterEffect = new WaterEffect( this.touchTexture.texture);

const waterPass = new EffectPass(this.camera, this.waterEffect);

renderPass.renderToScreen = false;
waterPass.renderToScreen = true;
this.composer.addPass(renderPass);
this.composer.addPass(waterPass);
}
}

And here we have the final result!

An awesome and fun effect to play with!

Conclusion

Through this article, we’ve created ripples, encoded their data into the color channels and used it in a postprocessing effect to distort our render.

That’s a lot of complicated-sounding words! Great work, pat yourself on the back or reach out on Twitter and I’ll do it for you ?

But there’s still a lot more to explore:

Drawing the ripples with a hollow circle

Giving the ripples an actual radial-gradient

Expanding the ripples as they get older

Or using the canvas as a texture technique to create interactive particles as in Bruno’s article.

We hope you enjoyed this tutorial and had a fun time making ripples. If you have any questions, don’t hesitate to comment below or on Twitter!

Creating a Water-like Distortion Effect with Three.js was written by Daniel Velasquez and published on Codrops.

macOS Catalina: 5 Things Web Developers & Designers Should Know

Original Source: https://www.sitepoint.com/macos-catalina-5-things-web-developers-designers-should-know/?utm_source=rss

macOS Catalina is here and available for download, and you’ve no doubt heard all about the breakup of iTunes and the new consumer-oriented entertainment apps shipping with the system.

But what do developers, designers, and other tech professionals need to know? We run through the key points.

32-bit Support Ends with Catalina

Are you relying on some older, obscure native app for a specific function, as so many developers and designers do? Your Catalina update could throw you a wildcard: it’s the first macOS release that drops support for 32-bit apps.

During the setup process, you’ll be given a list of installed apps that will no longer open after the update. If you want to keep using that tool, it’s time to hit up the developer for a long-overdue update… or stay on Mojave for a while longer yet.

A Cross-Platform Catalyst

Mojave brought iOS ports of the News, Stocks, Voice Memos and Home apps to macOS. In Catalina, Apple is opening the tools that enabled these ports up to developers under the name of Catalyst.

While this doesn’t directly affect web development work, it does make iOS a more attractive native development platform, which may inform your future platform choices. And if Apple’s plan to reinvigorate stale macOS third-party app development with some of the action from iOS works, you could incorporate better productivity and development apps into your workflow in the near future.

For now, Catalyst is available to developers of iPad apps — we expect that to broaden in the future.

Voice Control

Catalina offers accessibility improvements in the form of improved Voice Control for those who have difficulty seeing, or using keyboards and mice.

Of course, developers should ensure that their apps work as well as they can with this tool, because it’s the right thing to do.

Developers are known for their love of keyboard shortcut mastery, but no doubt the ability to create custom commands has inspired determined lifehackers. What if you never had to take your cursor or eyes off of VS Code to run other frequent workflows?

We look forward to seeing what the community comes up with.

Screen Time

Do you waste too much time using your computer for mindless entertainment, forcing you to stay up late making up the time productively?

Or are you a workaholic who just can’t find the will to shut off and disconnect?

If you’re like most of us in the industry, you’re a mix of the two. Catalina introduces a variant of the Screen Time app that’s been on iOS for a couple of years now.

Screen Time for macOS provides you with visual analytics that help you understand the way you’re spending time on your device, which can often lead to some unexpected epiphanies. It also lets you schedule downtime, forcing you off the computer and into the real world at the right time.

As with iOS, you can also set time limits for specific apps, and there are some ways to moderate your web content usage without outright blocking your web browser from opening.

Sidecar: The Most Expensive Secondary Display You’ll Ever Own

For developers, designers, and all other web professionals, the real headline feature of Catalina is Sidecar. Sidecar turns your iPad into a secondary display for your Mac, and it’s really easy to enable (provided you have the requisite tablet, which is not included with the operating system update).

The best reason to use Sidecar over a standard display is Apple Pencil integration. Designers will love the ability to draw directly on the screen when using Sketch and Illustrator without switching devices all the time. You can even mirror your Mac’s screen if you’d like an unobstructed view of what you’re sketching on one side.

Most of us will use Sidecar as a place to dump Slack or a terminal window, but in any case, it’s clear it’ll be the most beneficial update for many of us.

How’d You Go?

Let us know how you went with the upgrade, and what you’ve enjoyed most so far. We always recommend waiting a few days for the bugs to shake out — especially with Apple’s recent track record — but initial reports suggest the release version is pretty solid after all.

The post macOS Catalina: 5 Things Web Developers & Designers Should Know appeared first on SitePoint.

The best art easels in 2019

Original Source: http://feedproxy.google.com/~r/CreativeBloq/~3/GH64HBtuDCc/the-best-art-easels-in-2019

Once you've found the best art easel for you, you'll probably spend hours at it, so it’s very important to invest in one that will suit your needs and be comfortable. There are several things to bear in mind when deciding what type to buy, as an art easel is one of the most important art supplies in your toolbox (see our guide to more essential art supplies). 

Space could be a consideration – you may need to be able to pack away your setup at the end of each session, meaning you'll be looking for a foldaway or lightweight small easel you can carry with you. Or, you might be looking for a more solid studio easel that will be a more permanent fixture in your space, and last you a lifetime. Or perhaps you're looking for an art easel for the child or small person in your life. 

A quality art easel can be a fairly considerable investment so it’s worth taking some time to think about your needs before you begin. This guide will help you navigate some of the options available to fledgling artists and help you find the best art easel for you. And never fear if your budget isn't massive, as we've got the best art easels for a range of price points.

Looking for more art supplies? Also check our post on the best pencils and the best sketchbooks. It's also worth keeping an eye on the best Black Friday deals.

art easel: Basic Studio Easel Mabef M/09

Mabef easels are designed for quality and longevity. I have personally owned a number of Mabef designs for over 25 years and they’re all still going strong. Made from stain-resistant oiled beech wood, the finishing on these Basic Studio Easel Mabef easels is beautiful and well worth the investment. The M/09 model is a great starting point for the serious studio artist on a budget. Although it doesn’t have some of the frills of other models, the M/09 is a solid model that will stand the test of time and will prove a good studio work-horse for the burgeoning professional studio.

art easel: Heavy Duty Large H-frame Studio Easel

This heavy duty studio easels a great mid-point for a lot of artists’ needs. It’s not from a big name but the overall functionality certainly makes up any difference. An Atworth H-frame easel will give you a more stable easel to work on, and, although it’s not collapsable, the wheels make it easy to move around the studio as needed. You can also convert it into a horizontal easel, which gives you a wealth of options when it comes to your medium, too. Convertible easels are perfect for watercolour painting or just as extra table space.

art easel: Mini Easel

Some table easels come as a box with ample storage to save space, which can seems like a good option at first. The stumbling block of these designs is their lack of adjustability. If you’re working at a table then you need to be able to adjust the baseline of your canvas, that’s to say, how high the bottom of your canvas is from the table. That's where this Mini Easel really comes into its own. The adjustability of this easel enables you to work at your own height, which will save you a lot of discomfort in the long run.

art easel: Melissa & Doug Deluxe Wooden Standing Art Easel

When it comes to your child’s creativity you don’t want to instal limitations so versatility is the key word. Melissa & Doug have built themselves a name as one of the top suppliers of kids' creative kit over the past 30 years so they must be doing something right. This multi-use easel by Melissa & Doug is easy to assemble, folds away easily for storage and includes a dry-erase board, chalkboard, locking paper-roll holder, child-safe paper cutter, four easy-clip grips and two large plastic trays that can be removed for easy cleaning. Hours of messy fun guaranteed.

art easel: Melissa & Doug Deluxe Double-Sided Tabletop Easel

Younger children won’t stand for long at an easel, and will often be tempted to push their easel over, so a table easel can be a better option, and table easels can also be set up on the floor to make them even more accessible. A table-top easel from a trusted name like Melissa & Doug such as this double-sided tabletop easel is a great option for those younger Picassos. Its built-in paper roll, reversible design and sturdy wooden construction make this a great option that’s designed to inspire hours of fun.

art easel:

If you’re looking to kit yourself or someone else out with a full artistic kit including an easel then the 111 Piece All Media Art Studio Paint Set from Daler Rowney could be a good place to start. Now, most of this kit is student grade or below, but it’s enough to get most people started off with a host of mediums and is a good place to build upon. The kit includes one aluminium easel, one carrying case, one eraser, one pencil pouch, a stretched canvas, mixing palette, pencil sharpener, one set of travel watercolours, colouring pencils, oil pastels, acrylics, brushes and much more. 

art easel:

This  Ktaxon Tripod Easel Stand with drawer is made of high quality beech. If you’re tight for space, or just don’t want your paint left out for little fingers or paws, then the addition of the drawer at the base of this easel is a huge plus. This adjustable easel makes a handsome addition to your home or studio and is also a great way to display your work to visiting friends and family when not in use. If you’re looking for an easel for part-time use at home, this is a great choice.

Read more:

Pixel art: 34 retro examplesEssential art supplies for paintingThe best sketchbooks available now

Exciting New Tools for Designers, October 2019

Original Source: https://www.webdesignerdepot.com/2019/10/exciting-new-tools-for-designers-october-2019/

It’s already time to start thinking about all the seasonal design elements that you will use for the rest of the year. That might be icons or illustrations or fonts. We have a few new elements this month that might fit the bill, as well as learning tools and inspiration. Here’s what new for designers this month.

UIPrint

UIPrint is a set of sketching templates for devices that you can print out to create with a pen (because some of us love to draw mocks and ideas in meetings). The current collection includes more than 10 printable wireframes and sketchpads. Grab prints for devices you use most of download the whole set and get printing.

Haptics

Haptics provides developers with a quick and easy way to see what the different haptic feedback is like on supported iPhone & Apple Watch models. Available only in the iTunes store and requires iOS 13.0+.

HTTP Mock

HTTP Mock allows you to intercept and view all of your HTTP (and HTTPS) mock endpoints or entire servers and rewrite, redirect, or inject errors.

Art of Symbols

Art of Symbols is a project published by Emotive Brand that takes a look at the root the design and meanings of common icons and symbols. The project was originally published day by day as an Instagram project, but has been compiled into a website that’s super informative and fun to look at.

Smoother & Sharper Shadows

Smoother & Sharper Shadows is a tutorial that will help you clean up the look of drop shadows using the box-shadow CSS property. You can get more control over the look of shadows for more polished designs.

Copy Monkey

CopyMonkey uses machine learning to mimic your handwriting style like a monkey. There’s not a lot of work value in this one, but it is a lot of fun to play with.

CTRL+Z

CTRL+Z is a fun interactive flyer that can provide a source of inspiration. Click and drag to see just how this flyer for an upcoming art installation works.

Shape

Shape lets you customize the style, colors and border of more than 1,000 static and animated icons and illustrations. Export to React, SVG and Lottie. The tool also includes UI templates to help you use icon collections.

Winning Icons

Winning Icons is a set of 50 vectors that celebrate achievement. With medals and celebratory icons in three styles, this collection is made for winning. The set is available in SVG and JPG format.

Sketch Devices

Devices is an updated set of modern device mockups for Sketch by the team at Facebook Design. From the design team: “Facebook supports a diverse audience around the world and an equally diverse set of devices. To emphasize that in our design mocks, we redrew a range of devices to show the global diversity of the people using our products. Each device comes with a bitmap of the device (with and without shadows) and the original Sketch file for that device.”

Animated Icons

Animated Icons is a collection of fun line icons with interesting animations for something a little extra in your projects. Download the JSON for Lottie, GIF, or After Effects formats. Pick and choose icons or download them all.

Fresh Folk

Fresh Folk is an interesting collection of illustrations of people, places, and objects to enhance design projects. You can use illustrations as mix and match characters and scene elements to create almost custom illustrations from the library.

Where to Put Buttons on Forms

What’s the perfect placement for a button on a form? Well, it depends on what information is in the form. This great explanation/tutorial by Adam Silver can help you think about the logic behind button placements and make your forms more user-friendly.

Mozilla Developer Video Shorts

The team at Mozilla Developer has launched a new video series packed with demos and tools that teach web technologies. You can find the first few videos on their website or follow the channel on YouTube for new videos when they post.

Fliplet

Fliplet is a “prefab” no-code app editor that helps you build all kinds of different apps without coding. It uses a library of open source components, or you can create your own. The core feature base includes everything you need to get started with an app build.

Quickmetrics

Quickmetrics is a dashboard-based data collection and sharing tool. Track all kinds of data including signups, response times, or almost anything.

Deep Work Stats

Deep Work is a productivity tool that helps you see how you’re actually spending time on the job. It scans your calendar and computer time to determine how much time you have for deep work and shallow work, how much time you spend in meetings, and how you compare to co-workers and globally.

Bridamount

Bridamount is a handwriting style typeface with a fun set of special characters. (And it’s free for commercial use as well.) It includes a full upper- and lowercase character set.

Cascadia Code

Cascadia Code is a monospaced font that’s still in development. You can modify it using glyphs and FontTools. It includes programming ligatures and is designed to enhance the modern look and feel of the Windows Terminal.

Dealerplate California

Dealerplate Cailfornia is a funky typeface that mimics the letterforms on license plates. This is one state in the font set that features 17 fonts.

Krisha

Krisha is a display font with an all caps character set and funky smooth lines for letterforms. It’s big and bold and one of those few free fonts that’s also available for commercial use.

Mallie

Mallie is modern, fusion font with multilingual support. It’s a very versatile font that would make for a fun brand design.

Santa Claus

It’s not too early to start planning Christmas designs. This comic style font, Santa Claus, could be just the right element. It makes for an interesting uppercase only display.

Scarekrowz

Just for Halloween is Scarekrowz, a funky spooky typeface for the season. The font includes just 94 characters, but could make for a fun, seasonal display.

Source

p img {display:inline-block; margin-right:10px;}
.alignleft {float:left;}
p.showcase {clear:both;}
body#browserfriendly p, body#podcast p, div#emailbody p{margin:0;}

40+ Motivational Quotes for Creatives

Original Source: http://feedproxy.google.com/~r/1stwebdesigner/~3/g-KZEFB4RP4/

Sometimes we all need a little motivation. The road to creating something great can be tough. There are many twists and turns, failures, trials and tribulations. We all grow a little weary.

The goal of this article is to reinvigorate your creativity with empowering quotes from creators, inventors, and entrepreneurs of all backgrounds.

These quotes vary in nature. Some apply to work ethic, some for inspiration and determination, and others are just great phrases to live by. Get inspired with these quotes for creators below and then get creating!

View more inspirational articles on 1stwebdesigner →

A bridge crossing over water.

Your Web Designer Toolbox
Unlimited Downloads: 500,000+ Web Templates, Icon Sets, Themes & Design Assets


DOWNLOAD NOW

Be Inspired to Create

“…If one advances confidently in the direction of his dreams, and endeavors to live the life which he has imagined, he will meet with a success unexpected in common hours…If you have built castles in the air, your work need not be lost; that is where they should be. Now put the foundations under them.” – Henry David Thoreau

“To know your life purpose is to connect with a higher power.” – Shannon L. Alder

“Inspiration exists, but it has to find you working.” – Pablo Picasso

“Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful.” – Albert Schweitzer

“It’s never too late to be who you might have been.” – George Eliot

“If you cannot do great things, do small things in a great way.” – Napoleon Hill

A person holding a small plant.

“With the advent of spring and beginning of the new harvest season the creators of abundance, our peasants, come out to the fields to sow with good aspirations and hopes.” – Islom Karimov

“To dare is to lose one’s footing momentarily. To not dare is to lose oneself.” – Soren Kierkegaard

“Success is going from failure to failure without losing enthusiasm.” – Winston Churchill

“The other side of every fear is a freedom.” – Marilyn Ferguson

“Opportunity is missed by most because it is dressed in overalls and looks like work.” – Thomas Edison

“Problems cannot be solved at the same level of awareness that created them.” – Albert Einstein

“A creative man is motivated by the desire to achieve, not by the desire to beat others.” – Ayn Rand

“What we see depends mainly on what we look for.” – John Lubbock

A rocky coastline.

“Whether you think that you can, or that you can’t, you are usually right.” – Henry Ford

“I always prefer to believe the best of everybody; it saves so much trouble.”  – Rudyard Kipling

“You don’t need money to be creative. The ghetto builds champions every day.” – DJ Snake

“The most dangerous idea is silencing people.” – Naval Ravikant

“A busy calendar and a busy mind will destroy your ability to do great things in this world. If you want to be able to do great things, whether you’re a musician, or whether you’re an entrepreneur, or whether you’re an investor, you need free time and you need a free mind.” – Naval Ravikant

“The cure for boredom is curiosity. There is no cure for curiosity.” – Dorothy Parker

“Go into yourself. Find out the reason that commands you to write; see whether it has spread its roots into the very depths of your heart; confess to yourself whether you would have to die if you were forbidden to write.” – Rainer Maria Rilke

“So go on, get angry. But keep your mouth shut and go do your work.” – Austin Kleon

“Somewhere, something incredible is waiting to be known.” – Carl Sagan

A mountain on a starry night.

“The world always seems brighter when you’ve just made something that wasn’t there before.” – Neil Gaiman

“We don’t make mistakes, just happy little accidents.” – Bob Ross

“Many prefer not to exercise their imaginations at all. They choose to remain comfortably within the bounds of their own experience, never troubling to wonder how it would feel to have been born other than they are.” – J.K. Rowling

“A new idea is delicate. It can be killed by a sneer or a yawn; it can be stabbed to death by a quip and worried to death by a frown on the right man’s brow.” – Charles Brower

“Remember the two benefits of failure. First, if you do fail, you learn what doesn’t work; and second, the failure gives you the opportunity to try a new approach.” – Roger Von Oech

“I’m convinced that about half of what separates successful entrepreneurs from the non-successful ones is pure perseverance.” – Steve Jobs

“Anxiety is the handmaiden of creativity.” – T. S. Eliot

Waves crashing on a beach.

“You can’t use up creativity the more you use the more you have.” – Maya Angelou

“There is only one of you in all time. This expression is unique and if you block it, it will never exist through any other medium and it will be lost.” – Martha Graham

“Creative people are curious, flexible, persistent, and independent, with a tremendous spirit of adventure and a love of play.” – Henri Matisse

“Curiosity about life in all of its aspects, I think, is still the secret of great creative people.” – Leo Burnett

“You can’t wait for inspiration, you have to go after it with a club.” – Jack London

“To raise new questions, new possibilities, to regard old problems from a new angle, requires creative imagination and marks real advance in science.” – Albert Einstein

“The essential part of creativity is not being afraid to fail.” – Edwin H. Land

“Creative activity could be described as a type of learning process where teacher and pupil are located in the same individual.” – Arthur Koestler

“Don’t think. Thinking is the enemy of creativity. It’s self-conscious, and anything self-conscious is lousy. You can’t try to do things. You simply must do things.” – Ray Bradbury

“Blessed are the curious, for they shall have adventures.” – L. Drachman

“In the beginner’s mind there are many possibilities, but in the expert’s mind there are few.” – Shunryu Suzuki

A young girl looks off into the distance.

Quotes That Will Make You Think…

For this last section, we’re featuring just a few more quotes for creators that are less motivational and moreso thought-provoking.

“We call ourselves creators and we just copy.” – Lauryn Hill

“The most regretful people on earth are those who felt the call to creative work, who felt their own creative power restive and uprising, and gave to it neither power nor time.” – Mary Oliver

“If you’re creating anything at all, it’s really dangerous to care about what people think.” – Kristen Wiig

“Great is the human who has not lost his childlike heart.” – Mencius (Meng-Tse)

“When Alexander the Great visited Diogenes and asked whether he could do anything for the famed teacher, Diogenes replied: “Only stand out of my light.” Perhaps some day we shall know how to heighten creativity. Until then, one of the best things we can do for creative men and women is to stand out of their light.” – John W. Gardner

“Don’t worry about people stealing your ideas. If your ideas are any good, you’ll have to ram them down people’s throats.” – Howard Aiken

“Some men look at things the way they are and ask why? I dream of things that are not and ask why not?” – Robert Kennedy

Words of Wisdom

Which quote stood out the most to you? We hope you use these motivational and thought-provoking words to boost your creativity and make the world a more beautiful place. You can do it!


Cloning Tinder Using React Native Elements and Expo

Original Source: https://www.sitepoint.com/cloning-tinder-using-react-native-elements-expo/?utm_source=rss

Cloning Tinder Using React Native Elements and Expo

Making pixel-perfect layouts on mobile is hard. Even though React Native makes it easier than its native counterparts, it still requires a lot of work to get a mobile app to perfection.

In this tutorial, we’ll be cloning the most famous dating app, Tinder. We’ll then learn about a UI framework called React Native Elements, which makes styling React Native apps easy.

Since this is just going to be a layout tutorial, we’ll be using Expo, as it makes setting things up much easier than plain old react-native-cli. We’ll also be making use of a lot of dummy data to make our app.

We’ll be making a total of four screens—Home, Top Picks, Profile, and Messages.

Prerequisites

For this tutorial, you need a basic knowledge of React Native and some familiarity with Expo. You’ll also need the Expo client installed on your mobile device or a compatible simulator installed on your computer. Instructions on how to do this can be found here.

You also need to have a basic knowledge of styles in React Native. Styles in React Native are basically an abstraction similar to that of CSS, with just a few differences. You can get a list of all the properties in the styling cheatsheet.

Throughout the course of this tutorial we’ll be using yarn. If you don’t have yarn already installed, install it from here.

Also make sure you’ve already installed expo-cli on your computer.

If it’s not installed already, then go ahead and install it:

$ yarn global add expo-cli

To make sure we’re on the same page, these are the versions used in this tutorial:

Node 11.14.0
npm 6.4.1
yarn 1.15.2
expo 2.16.1

Make sure to update expo-cli if you haven’t updated in a while, since expo releases are quickly out of date.

We’re going to build something that looks like this:

Tinder Demo in Expo

If you just want to clone the repo, the whole code can be found on GitHub.

Getting Started

Let’s set up a new Expo project using expo-cli:

$ expo init expo-tinder

It will then ask you to choose a template. You should choose tabs and hit Enter.

Expo Init - Choose A Template

Then it will ask you to name the project. Type expo-tinder and hit Enter again.

Expo Init - Name the Project

Lastly, it will ask you to press y to install dependencies with yarn or n to install dependencies with npm. Press y.

Expo Init - Install the dependencies

This bootstraps a brand new React Native app using expo-cli.

React Native Elements

React Native Elements is a cross-platform UI Toolkit for React Native with consistent design across Android, iOS and Web.

It’s easy to use and completely built with JavaScript. It’s also the first UI kit ever made for React Native.

It allows us to fully customize styles of any of our components the way we want so every app has its own unique look and feel.

It’s also open source and backed by a community of awesome developers.

You can build beautiful applications easily.

React Native Elements Demo

Cloning Tinder UI

We’ve already created a project named expo-tinder.

To run the project, type this:

$ yarn start

Press i to run the iOS Simulator. This will automatically run the iOS Simulator even if it’s not opened.

Press a to run the Android Emulator. Note that the emulator must be installed and started already before typing a. Otherwise it will throw an error in the terminal.

It should look like this:

Expo Tabs App

The post Cloning Tinder Using React Native Elements and Expo appeared first on SitePoint.

Create a Cron Job on AWS Lambda

Original Source: https://www.sitepoint.com/create-aws-lambda-cron-job/?utm_source=rss

Create a Cron Job on AWS Lambda

Cron jobs are really useful tools in any Linux or Unix-like operating systems. They allow us to schedule scripts to be executed periodically. Their flexibility makes them ideal for repetitive tasks like backups and system cleaning, but also data fetching and data processing.

For all the good things they offer, cron jobs also have some downsides. The main one is that you need a dedicated server or a computer that runs pretty much 24/7. Most of us don’t have that luxury. For those of us who don’t have access to a machine like that, AWS Lambda is the perfect solution.

AWS Lambda is an event-driven, serverless computing platform that’s a part of the Amazon Web Services. It’s a computing service that runs code in response to events and automatically manages the computing resources required by that code. Not only is it available to run our jobs 24/7, but it also automatically allocates the resources needed for them.

Setting up a Lambda in AWS involves more than just implementing a couple of functions and hoping they run periodically. To get them up and running, several services need to be configured first and need to work together. In this tutorial, we’ll first go through all the services we’ll need to set up, and then we’ll implement a cron job that will fetch some updated cryptocurrency prices.

Understanding the Basics

As we said earlier, some AWS services need to work together in order for our Lambda function to work as a cron job. Let’s have a look at each one of them and understand their role in the infrastructure.

S3 Bucket

An Amazon S3 bucket is a public cloud storage resource available in Amazon Web Services’ (AWS) Simple Storage Service (S3), an object storage offering. Amazon S3 buckets, which are similar to file folders, store objects, which consist of data and its descriptive metadata. — TechTarget

Every Lambda function needs to be prepared as a “deployment package”. The deployment package is a .zip file consisting of the code and any dependencies that code might need. That .zip file can then be uploaded via the web console or located in an S3 bucket.

IAM Role

An IAM role is an IAM identity that you can create in your account that has specific permissions. An IAM role is similar to an IAM user, in that it is an AWS identity with permission policies that determine what the identity can and cannot do in AWS. — Amazon

We’ll need to manage permissions for our Lambda function with IAM. At the very least it should be able to write logs, so it needs access to CloudWatch Logs. This is the bare minimum and we might need other permissions for our Lambda function. For more information, the AWS Lambda permissions page has all the information needed.

CloudWatch Events Rule

CloudWatch Events support cron-like expressions, which we can use to define how often an event is created. We’ll also need to make sure that we add our Lambda function as a target for those events.

Lambda Permission

Creating the events and targeting the Lambda function isn’t enough. We’ll also need to make sure that the events are allowed to invoke our Lambda function. Anything that wants to invoke a Lambda function needs to have explicit permission to do that.

These are the building blocks of our AWS Lambda cron job. Now that we have an idea of all the moving parts of our job, let’s see how we can implement it on AWS.

Implementing a Cron Job on AWS

A lot of the interactions we described earlier are taken care of by Amazon automatically. In a nutshell, all we need to do is to implement our service (the actual lambda function) and add rules to it (how often and how the lambda will be executed). Both permissions and roles are taken care of by Amazon; the defaults provided by Amazon are the ones we’ll be using.

Lambda function

First, let’s start by implementing a very simple lambda function. In the AWS dashboard, use the Find Services function to search by lambda. In the lambda console, select Create a function. At this point, we should be in Lambda > Functions > reate Function.

To get things going, let’s start with a static log message. Our service will only be a print function. For this, we’ll use Node.js 10x as our runtime language. Give it a function name, and on Execution Role let’s stay with Create a new role with basic lambda permissions. This is a basic set of permissions on IAM that will allow us to upload logs to Amazon CloudWatch logs. Click Create Function.

Create a new lambda function

Our function is now created with an IAM Role. In the code box, substitute the default code with the following:

exports.handler = async (event) => {
console.log(“Hello Sitepoint Reader!”);
return {};
};

To check if the code is executing correctly, we can use the Test function. After giving a name to our test, it will execute the code and show its output in the Execution Result field just below our code.

If we test the code above we can see that we have no response, but in the function logs, we can see we have our message printed. This indicates that our service is running correctly so we can proceed with our cron implementation.

The post Create a Cron Job on AWS Lambda appeared first on SitePoint.

15 Textured Grunge Fonts With a Handmade Style

Original Source: http://feedproxy.google.com/~r/1stwebdesigner/~3/w3wv63J2uAA/

Are you on the hunt for some gritty, textured experimental fonts for your website? Grunge style typography might be just what you need.

The inspiration for many art styles, grunge music and fashion is associated with harsh songs, ripped jeans, and distorted instrument sounds. It was an unorthodox genre far removed from cleaner brands of music.

Grunge typography is much the same, sharply divulging from traditional elegant serifs and clean sans-serifs to create a new unique style. These fonts tend to have a dirty, smudged, paint-brushed, or eroded look. They can be simple and legible or distorted and dramatic.

These fonts look great on rock music sites and graphics, but anyone can use them. If you want to add a little texture and variation to your project, or need to draw eyes to a part of your website, try one of these stand-out grunge fonts.

UNLIMITED DOWNLOADS: 400,000+ Fonts & Design Assets

DOWNLOAD NOW

Fierce by Itsmesimon

Example of Fierce by Itsmesimon

UnderWorld by hmeneses

Example of UnderWorld by hmeneses

Ugly Alligator by Cosmic Store

Example of Ugly Alligator by Cosmic Store

Bearpaw by Dennis Anderson

Example of Bearpaw by Dennis Anderson

Smile and Wave by Chris Vile

Example of Smile and Wave by Chris Vile

Brush Up by PintassilgoPrints

Example of Brush Up by PintassilgoPrints

Splandor Typeface by ilhamherry

Example of Splandor Typeface by ilhamherry

New York by Saji Johnny Kundukulam

Example of New York by Saji Johnny Kundukulam

Conspiracy by Nerfect Type Laboratories

Example of Conspiracy by Nerfect Type Laboratories

Grunge Tire by Just Type It

Example of Grunge Tire by Just Type It

Crayon Hand by Letters & Numbers

Example of Crayon Hand by Letters & Numbers

Beyond Wonderland by Chris Hansen

Example of Beyond Wonderland by Chris Hansen

Againts Typeface by Fortunes Co

Example of Againts Typeface by Fortunes Co

Gunshot by Gleb Guralnyk

Example of Gunshot by Gleb Guralnyk

Eveleth by Yellow Design Studio

Example of Eveleth by Yellow Design Studio

Unconventional, Interesting Fonts

If you’re tired of clean web design and want to put a spin on things, you should definitely consider grunge typography. The fonts are highly unique, and thus overuse can dull their message. But a grunge font in just the right place can attract attention and add a little interest to a bland webpage.

You don’t have to be making a rock website to use grunge fonts. You can find more subtle textured effects on all sorts of websites, especially ones that want to add a natural feel or tell the world that they’re unconventional.

Using a grunge font in just the right place can leave a big impact on visitors, so don’t be afraid to try one.


Editorial Design Patterns With CSS Grid And Named Columns

Original Source: https://www.smashingmagazine.com/2019/10/editorial-design-patterns-css-grid-subgrid-naming/

Editorial Design Patterns With CSS Grid And Named Columns

Editorial Design Patterns With CSS Grid And Named Columns

Rachel Andrew

2019-10-04T12:30:00+02:00
2019-10-04T12:35:51+00:00

Many websites, in particular those which display long-form content, have a fairly straightforward repeating pattern of components: a full-width area for images, a central content area, and perhaps a split view of two half-width blocks. These components repeat to display an article, images and other related content — with content editors selecting the right component as they create articles for publication.

In this article, I’m going to demonstrate an approach to this kind of editorial design, which builds on a few techniques some of which are discussed in the following articles:

“Breaking Out With CSS Grid Layout”
“Breaking Out With CSS Grid Explained”
“Naming Things In CSS Grid Layout”

In addition to this being a nice way to name sections of your layout, this technique exposes a whole bunch of interesting things about Grid Layout which you may find useful in creating your own layout patterns. It also demonstrates more of the promise of subgrid (a part of the upcoming Level 2 of the grid specification and being implemented in Firefox).

Naming Things In CSS Grid Layout

When using CSS Grid Layout, you can name lines and areas. Both of these things can make working with Grid — especially complex grids — more straightforward. Defining naming conventions for things in your layout can be useful when working with your team; it is much easier to understand where anything placed with grid-area: content will end up than having something placed from column-line: 3 / 9.

When using the grid-template-areas approach, you give the items that you want to place on the grid a name by using the grid-area property and then placing them around the grid. In the following example, the item with grid-area: content goes into the grid area defined by the grid-template-areas property:

See the Pen [Layout With Named Area](https://codepen.io/rachelandrew/pen/zYOQBba) by Rachel Andrew.

See the Pen Layout With Named Area by Rachel Andrew.

This works well for components where you have one item to go into one area; however, if you want to place multiple things into the content area (one below the other), using grid-area is the wrong approach. Instead, you might define names for the column lines and place the item from the start to end line.

See the Pen [Layout With Named Columns](https://codepen.io/rachelandrew/pen/xxKNONQ) by Rachel Andrew.

See the Pen Layout With Named Columns by Rachel Andrew.

This isn’t as neat, however, when using the grid-area approach we have to know both the start and end line when placing an item using grid-column or grid-row — or do we?

Take a look at this next CodePen example. My items are placed using a single name or ident by using the grid-column property, even though some of the grid areas being targeted cross a number of columns:

See the Pen [Layout with Named Columns](https://codepen.io/rachelandrew/pen/mdbYEod) by Rachel Andrew.

See the Pen Layout with Named Columns by Rachel Andrew.

My aim here is to abstract away the complexity of the grid setup when actually using the grid. I can put a lot of work into creating the initial grid, but then place things without thinking too much about it as I populate my pages. I also want to make sure that we can repeat the components as often as we need to as we build up the article. What I have in mind is a content creator using a CMS, and creating blocks of content using the different patterns whilst knowing that they will be placed correctly one below the other on the overall grid.

In order to understand how I got to this point requires an understanding of a few things about CSS Grid Layout as well as named lines and areas.

We Can Name Lines

As you’ve already seen in my second example above, we can name lines on the grid that can be pretty much anything we like — other than the word span. The name is an ident rather than a string which is why it is not quoted.

However, you will see many examples where the naming conventions name-start and name-end are used that append -start onto the name of the start line and -end on the name of the end line. This is not purely convention and for the technique I am going to show you why we need to name our lines this way. So you should pick a name for the area you are describing, and then add the -start and -end suffixes — which need to match, of course!

We name our lines inside square brackets. Lines can (and often need to) have multiple names. In this case, space separates the names. When placing the items using line-based positioning, you can pick any name for the line to do the placement.

With our named lines in place, we could place our items using grid-column by specifying the start and end line name. This pattern is just the same as using line numbers, so the name before the slash is the start line and the name after is the end line.

See the Pen [Example using start and end lines](https://codepen.io/rachelandrew/pen/VwZOPgO) by Rachel Andrew.

See the Pen Example using start and end lines by Rachel Andrew.

This places the items but isn’t the neat single name per item that I used in the example. However, we now have everything in place due to the special way that Grid handles named areas and lines.

Line Names Give Us A Named Area

Assuming you have named your lines with -start and -end as I have, Grid will give you a named area of the main name you used. Therefore, in my case, I have areas named content, start-half, end-half, full and center. Each of these areas is a single row (as I don’t have named rows), however, it will span the column tracks from the -start to the -end line.

Named Areas Give Us A Named Line Of The Main Name Used

If we want to be able to place our items as if we have a column name, we also need to make use of the fact that when we create a grid area, we get a line name of the main name used; that is, the main name being the name with -start and -end removed. This line name resolves to the start or end of the area depending on whether we are targeting grid-column-start or grid-column-end.

So, we have an area named content, because we have column lines named content-start and content-end. The area named content also gives us the ability to use grid-column-start: content which will resolve to the start line of that content area, while grid-column-end: content will resolve to the end line of the content area.

This, therefore, means that we can place an item into the content area by using the following:

.content {
grid-column: content / content;
}

Next, we can now tidy up this technique further due to the fact that if you use a named line for grid-column-start and omit the end line (rather than spanning one track as would be the case if you used line numbers), grid copies the name over to the end line. Therefore, grid-column: content is exactly the same as grid-column: content / content;

This is then all we need to be able to place items using grid-column with a simple, single name. This behavior is all exactly as specified and not some kind of “hack”. It demonstrates the depth of thinking that went into the creation of the Grid Layout specification, and the amount of careful work that has gone into making it so straightforward to lay items out in our designs.

Giving This Technique Superpowers With Subgrid

I think this technique is a nice one that enables a very straightforward way of declaring where elements should be placed on the grid. However, if we add subgrid support to the mix, it becomes very powerful indeed.

Currently, subgrid is being implemented in Firefox, and so these next examples require Firefox Nightly to run. You can download Nightly here.

The subgrid value of grid-template-columns and grid-template-rows means that sizing created on a parent grid can be opted into by an item which is a child of the grid (assuming it is also using grid layout) by having display: grid applied.

Note: You can read more about the features of subgrid in my articles here on Smashing Magazine “CSS Grid Level 2: Here Comes Subgrid” and “Digging Into The Display Property: Grids All The Way Down”.

Line Names From The Parent Are Passed Into Subgrids

In addition to the track sizing information being passed into the child grid, any line names set on the parent will be passed in. This means that we can use our “column names” within subgridded components, making this solution very useful in a world where subgrid exists. An item placed in content — even if nested down inside subgrids — will line up with one placed as a direct child of the main grid.

In this next example, I have nested two elements directly inside the div with a class of full-2. I have also placed a ul inside .content. If we look at the items inside full-2, in order to place these on the parent grid, we need to make the selector full-2 a grid with display: grid then use the grid-template-columns property with a value of subgrid.

This causes the grid on .full-2 to use the tracks defined on the parent grid, and have access to the named lines defined there. As this is a full-width item, this really will behave just like the parent grid in terms of placing our items. We can then use any of the names we defined for the different columns to place the items. In this case, I have set both child elements to grid-column: center and they display one after the other in that center area.

.full-2 {
grid-row: 4;
grid-column: full;
display: grid;
row-gap: 10px;
grid-template-columns: subgrid;
}

.full-2 > div {
background-color: rgb(124,222,220);
grid-column: center;
}

A set of boxes, one with other boxes nested instead

The nested elements line up with the grid on the parent (Large preview)

If we take a look at our nested ul inside .content, we will need to create a subgrid on the selector .content just as with the last example; when we do this, the ul falls into the first track of the subgrid. If we want to lay out the listen items on the subgrid, we need to do two things: cause the ul to take up the same area as its parent by placing it with grid-column: content, and then making it a grid which is a subgrid.

Having done this the list items will lay out using auto-placement into the column tracks of the subgrid:

.content {
grid-row: 1;
grid-column: content;
display: grid;
grid-template-columns: subgrid;
}

.content ul {
grid-column: content;
display: grid;
row-gap: 10px;
grid-template-columns: subgrid;
}

A set of boxes, the nested boxes falling into the tracks of the grid

With auto-placement the items fall into the tracks of the parent (Large preview)

Once you have your grid, you can use the names from the parent in exactly the same way as before.

.content li:nth-child(1) {
grid-column: center;
}

.content li:nth-child(2) {
grid-column: start-half;
}

.content li:nth-child(3) {
grid-column: end-half;
}

.content li:nth-child(4) {
grid-column: content;
}

Screenshot of various boxes, which line up in columns

The completed subgrid layout (Large preview)

If you have Firefox Nightly, you can see the full demo in this CodePen example:

See the Pen [Naming Column and Subgrid](https://codepen.io/rachelandrew/pen/OJLYRRb) by Rachel Andrew.

See the Pen Naming Column and Subgrid by Rachel Andrew.

You can keep “nesting’ subgrids into your markup structure like this, and each time the line names will be passed through. This is a feature that I think will be particularly useful.

When you create a subgrid, the line numbers correspond to the lines of the subgrid and not the parent grid. Therefore, if you do want to ensure that elements in the subgrid line up with the parent grid, then using line names or named areas (as shown in this example) will make that straightforward and logical.

Wrapping Up

You now know how to use this technique for your main grid, and hopefully, it won’t take too long before we start seeing support for subgrid in all browsers. It’ll enable techniques such as this one and make it incredibly powerful for us to use.

Smashing Editorial
(il)

Defend Your WordPress Website Against Brute-Force Attacks

Original Source: http://feedproxy.google.com/~r/1stwebdesigner/~3/f-AnFeBnM20/

Whether you’re fairly new to WordPress or an experienced developer, you might be surprised at just how often your websites are under attack. You might also be wondering who, or what, is carrying out this type of activity – not to mention why they’d target you.

The answers are simple. In most cases, the bad actor is an automated bot. And you’re being targeted simply because you happen to be running WordPress. As the most popular Content Management System (CMS) out there, it is directly in the crosshairs of malicious actors.

While there are all sorts of different attacks floating around out there, the brute-force variety are among the most popular. And that happens to be our subject for today.

Let’s take a look at what brute-force attacks are and some ways you can better protect your WordPress website.

What Is a “Brute-Force” Attack?

A brute-force attack, according to Wikipedia:

“…consists of an attacker submitting many passwords or passphrases with the hope of eventually guessing correctly.”

In the real world, this means that a malicious script runs repeatedly, entering usernames and passwords into the WordPress login page. It’s possible to see hundreds or even thousands of attempts like this per day.

Of course, if this were all completely random, it would be pretty difficult to successfully log into a website using such a technique. But there are two major reasons why these attacks can sometimes work:

The use of weak login credentials, such as using an ultra-common username and password.
Using credentials that have been previously leaked elsewhere.

If either of these scenarios are in place, that raises the odds of a successful attack. And once the attacker has access to your WordPress dashboard, they can wreak all sorts of havoc.

But even if unsuccessful, these attacks can be both an annoyance and a drain on server resources. Therefore, it’s important to put policies in place that can help mitigate their damage.

Binary code on a computer screen.

Ways to Fight Back

Thankfully, there are a number of things you can do to better protect your WordPress website against brute-force attacks. The most basic being instituting common sense security measures, such as using strong passwords and virtually anything other than “admin” as your username. These steps alone will at least make your site more difficult to crack.

However, there are some even stronger actions you can take, including:

Limit Access to the Login Page

Depending on your web server’s setup, you might consider blocking out access to the WordPress login page to all but a specific group or range of IP addresses. On an Apache server, for example, this could be done via the .htaccess file.

The caveat is that this strategy depends on administrators having a static IP address. In corporate environments, this would likely be the case. However, other scenarios may make this method more difficult. The official WordPress documentation has some further advice that is worth a look.

Another approach is to password-protect the login page at the server level. While this adds a bit of inconvenience, it does help to ensure that only authorized users gain access to the dashboard.

Utilize a Plugin

There are a number of WordPress plugins that are dedicated to security, with several offering features designed to protect against brute-force attacks. Some of the more popular options include:

Jetpack’s “Protect” feature, which will block unwanted login attempts.

Wordfence employs several login-specific measures, such as two-factor authentication, reCAPTCHA and brute-force protection. There is also a companion plugin that solely focuses on login security.

Login LockDown is a plugin designed to limit brute-force attempts. It automatically locks out offending IP addresses after a set number of failed logins.

iThemes Security offers several login-related protections, including brute-force protection, two-factor authentication and the ability to rename the /wp-admin/ folder in order to thwart bots.

Employ a CDN/Firewall

Content Delivery Networks (CDNs) not only improve the performance of your website, they offer the side benefit of serving as a barrier between malicious bots and your WordPress install.

CDN providers often include methods to block out IP addresses or even entire countries from accessing your site (or, at least your dashboard). Depending on the service you use, there may also be protections specifically targeted at stopping brute-force attacks.

The beauty of this approach is that you can significantly lighten the load on your web server. How? Attackers are stopped by the CDN’s firewall before they ever reach your site. It’s kind of like having a giant flyswatter out in front of your house, rejecting pests before they make it to your front door.

A hammer smashing glass.

When It Comes to Security, Be Proactive

Unfortunately, doing nothing to combat brute-force logins is not a viable option. These attacks are both ubiquitous and relentless. And the landscape certainly doesn’t look like it will get better on its own. Therefore, it’s up to us to take preventative measures.

Thankfully, it’s not really that difficult. The options above, while not 100% perfect, are fairly easy to implement. And each one makes things that much tougher on the average bot.

Plus, when you think about it, the relative cost of mitigating these attacks now is much less than having to deal with a hacked website later on. That alone makes being proactive more than worth the effort.